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]

Re: RFC/RFA: patch for PR 22156: improve SRA for bit-fields


On Apr  5, 2007, Richard Henderson <rth@redhat.com> wrote:

> Ok.

Andreas tells me ppc-darwin fails to realize that align is definitely
assigned and warns about uninitialized uses.  This patch provides a
safe fallback initializer.  I just hope the compiler never starts
warning about obviously-dead assignments ;-)

I'm checking it in as obvious.

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

	* tree-sra.c (try_instantiate_multiple_fields): Needlessly
	initialize align to silence bogus warning.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c.orig	2007-04-05 15:50:18.000000000 -0300
+++ gcc/tree-sra.c	2007-04-05 18:00:09.000000000 -0300
@@ -1431,7 +1431,11 @@ try_instantiate_multiple_fields (struct 
     return f;
 
   /* Taking the alignment of elt->element is not enough, since it
-     might be just an array index or some such.  */
+     might be just an array index or some such.  We shouldn't need to
+     initialize align here, but our optimizers don't always realize
+     that, if we leave the loop without initializing align, we'll fail
+     the assertion right after the loop.  */
+  align = (unsigned HOST_WIDE_INT)-1;
   for (block = elt; block; block = block->parent)
     if (DECL_P (block->element))
       {
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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