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]

avoid uninitialized uses in see.c on ia64


I needed the patch below to pass bootstrap on ia64-linux-gnu.

I haven't investigated this, but I suspect see_get_extension_data
(that gets a pointer to an otherwise-uninitialized source_mode) is
inlined, and then GCC realizes that source_mode is not initialized in
very many cases.  In fact, I can see that for a PARALLEL, *source_mode
won't be set by see_get_extension_data(), but
see_merge_one_def_extension will happily compare the mode of each
SET_DEST in it with the uninitialized source_mode.  Oops.

This patch passed bootstrap and regtest on ia64-linux-gnu, but I won't
pretend this to be a proper fix.  I suggest a deeper analysis and a
more complete solution, but I thought I'd post this anyway in case
it's helpful, or if people conclude it's good enough of a fix.

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* see.c (see_merge_one_def_extension): Avoid bogus? uninitialized
	warning.

Index: gcc/see.c
===================================================================
--- gcc/see.c.orig	2008-05-13 02:24:54.000000000 -0300
+++ gcc/see.c	2008-05-13 05:30:11.000000000 -0300
@@ -2787,7 +2787,7 @@ see_merge_one_def_extension (void **slot
   enum rtx_code code;
   enum rtx_code extension_code;
   enum machine_mode source_extension_mode;
-  enum machine_mode source_mode;
+  enum machine_mode source_mode = VOIDmode;
   enum machine_mode dest_extension_mode;
   bool merge_success = false;
   int i;
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member       ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}

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