This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: uninitialized read error in bitmap.c

Inspired by Jason Molenda's use of valgrind to catch a cc1plus error, I
thought I'd try the same thing on jc1.  My first catch was in bitmap.c.
Local variable `c' in bitmap_equal_p eventually makes it into
bitmap_element_allocate, where we test the uninitialized field
`using_obstack' (which had a non-zero value in my test runs).  This
patch clears that field.  It also clears `indx' for good measure.


2002-09-09  Anthony Green  <>

	* bitmap.c (bitmap_equal_p): Clear all bitmap_head fields.

Index: gcc/bitmap.c
RCS file: /cvs/gcc/gcc/gcc/bitmap.c,v
retrieving revision 1.36
diff -u -p -r1.36 bitmap.c
--- gcc/bitmap.c	4 Jun 2002 07:06:53 -0000	1.36
+++ gcc/bitmap.c	10 Sep 2002 02:56:25 -0000
@@ -706,7 +706,7 @@ bitmap_equal_p (a, b)
   bitmap_head c;
   int ret;
-  c.first = c.current = 0;
+  c.first = c.current = c.indx = c.using_obstack = 0;
   ret = ! bitmap_operation (&c, a, b, BITMAP_XOR);
   bitmap_clear (&c);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]