This is the mail archive of the gcc-patches@gcc.gnu.org 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] Fix uninitialized memory use from ipa-prop.c (PR bootstrap/52041)


Hi!

Another thing discovered by valgrind on the same testcase.
The problem was that ao.volatile_p field, added recently, hasn't
been initialized in this spot.  I think it is safer to use ao_ref_init,
so that the next time some field is added the situation won't repeat.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-01-31  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/52041
	PR bootstrap/52039
	PR target/51974
	* ipa-prop.c (detect_type_change_1): Call ao_ref_init.

--- gcc/ipa-prop.c.jj	2011-12-14 08:11:03.000000000 +0100
+++ gcc/ipa-prop.c	2012-01-30 23:05:03.270693995 +0100
@@ -442,13 +442,11 @@ detect_type_change_1 (tree arg, tree bas
   if (!flag_devirtualize || !gimple_vuse (call))
     return false;
 
-  ao.ref = arg;
+  ao_ref_init (&ao, arg);
   ao.base = base;
   ao.offset = offset;
   ao.size = POINTER_SIZE;
   ao.max_size = ao.size;
-  ao.ref_alias_set = -1;
-  ao.base_alias_set = -1;
 
   tci.offset = offset;
   tci.object = get_base_address (arg);

	Jakub


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