This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC/RFA: patch for PR 22156: improve SRA for bit-fields
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Andreas Tobler <a dot tobler at schweiz dot ch>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 05 Apr 2007 18:09:58 -0300
- Subject: Re: RFC/RFA: patch for PR 22156: improve SRA for bit-fields
- References: <or648xoi7m.fsf@free.oliva.athome.lsd.ic.unicamp.br> <200703191249.52321.ebotcazou@adacore.com> <or8xdsihdy.fsf@free.oliva.athome.lsd.ic.unicamp.br> <oraby8gs5m.fsf@free.oliva.athome.lsd.ic.unicamp.br> <20070320234004.GB28738@redhat.com> <orejnjca8r.fsf@free.oliva.athome.lsd.ic.unicamp.br> <orvegqjhu5.fsf@free.oliva.athome.lsd.ic.unicamp.br> <or1wiz1e3h.fsf@free.oliva.athome.lsd.ic.unicamp.br> <20070405153845.GA2770@redhat.com>
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}