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]

[RFA:] Fix uninitialized-bug in gcc/bitmap.c, spotted by valgrind.

With (for example) gcc.dg/20020201-4.c, which uses -fssa,
you get several of these, both native and cross to

==2021== Conditional jump or move depends on uninitialised value(s)
==2021==    at 0x80A9BC2: bitmap_element_allocate (bitmap.c:110)
==2021==    by 0x80A93AC: bitmap_operation (bitmap.c:637)
==2021==    by 0x80A9778: bitmap_union_of_diff (bitmap.c:265)
==2021==    by 0x82CC936: df_lr_transfer_function (df.c:1662)

bitmap_element_allocate tests the using_obstack member.  The
right thing to do for a stack-allocated object seems to be to
set it to 0.

Bootstrapped and checked i686-pc-linux-gnu, plus checked that
the valgrind note is gone.

Ok to commit?

	* bitmap.c (bitmap_ior_and_compl, bitmap_union_of_diff):
	Initialize tmp.using_obstack to 0.

Index: bitmap.c
RCS file: /cvs/gcc/gcc/gcc/bitmap.c,v
retrieving revision 1.37
diff -p -c -r1.37 bitmap.c
*** bitmap.c	8 Oct 2002 07:19:34 -0000	1.37
--- bitmap.c	1 Dec 2002 05:52:26 -0000
*************** bitmap_ior_and_compl (to, from1, from2)
*** 725,730 ****
--- 725,731 ----
    bitmap_head tmp;

    tmp.first = tmp.current = 0;
+   tmp.using_obstack = 0;

    bitmap_operation (&tmp, from1, from2, BITMAP_AND_COMPL);
    bitmap_operation (to, to, &tmp, BITMAP_IOR);
*************** bitmap_union_of_diff (dst, a, b, c)
*** 742,747 ****
--- 743,749 ----
    int changed;

    tmp.first = tmp.current = 0;
+   tmp.using_obstack = 0;

    bitmap_operation (&tmp, b, c, BITMAP_AND_COMPL);
    changed = bitmap_operation (dst, &tmp, a, BITMAP_IOR);

brgds, H-P

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