[m-rev.] diff: Fixed a problem with gcc 3.3
Paul Bone
pbone at csse.unimelb.edu.au
Tue May 22 18:14:45 AEST 2012
Fix compatibility with older versions of GCC.
runtime/mercury_memory_zones.c:
GCC 3.3 reported a variable used uninitialised in this function.
It simply couldn't infer that the variable would be initialised, so a
dummy initialisation and explanation has been added.
Index: runtime/mercury_memory_zones.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
retrieving revision 1.46
diff -u -r1.46 mercury_memory_zones.c
--- runtime/mercury_memory_zones.c 4 Jan 2012 17:37:40 -0000 1.46
+++ runtime/mercury_memory_zones.c 22 May 2012 06:40:46 -0000
@@ -1214,9 +1214,19 @@
*/
cur_list = free_memory_zones;
+ /*
+ ** GCC 3.3 thinks that oldest_lru_token will used uninitialised.
+ ** But it won't, lru_free_memory_zones will always be NULL and
+ ** therefore the ** if branch will be followed to set this
+ ** variable before it is read in the condition of the else if
+ ** branch.
+ **
+ ** To avoid this problem we initialise oldest_lru_token.
+ */
+ oldest_lru_token = 0;
while(cur_list != NULL) {
cur_lru_token = cur_list->MR_zonesfree_minor_tail->MR_zone_lru_token;
- if (!lru_free_memory_zones) {
+ if (lru_free_memory_zones == NULL) {
oldest_lru_token = cur_lru_token;
lru_free_memory_zones = cur_list;
} else if (cur_lru_token < oldest_lru_token) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20120522/8bd4ebf0/attachment.sig>
More information about the reviews
mailing list