This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: uninitialized read error in bitmap.c
- From: Anthony Green <green at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jason-gcclist at molenda dot com
- Date: 09 Sep 2002 20:02:18 -0700
- Subject: 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.
Ok?
2002-09-09 Anthony Green <green@redhat.com>
* 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);