[PR38271] silence uninitialized warnings in SRA block-copied vars

Alexandre Oliva aoliva@redhat.com
Wed Dec 10 03:47:00 GMT 2008


Copying scalarized bit-fields into the base variable involves a
partial initialization that reads and preserves fields and padding
bits that might be uninitialized.  When we assign to a field or a
BIT_FIELD_REF, GCC already refrains from warning about the
uninitialized bits in the base variable, but when we lower the access
to word reads, masking, shifting, etc, as needed to enable all these
operations to be combined or optimized away, we need to tell GCC that
it's ok to access uninitialized portions of the variable.

In fact, SRA already dealt with partially-uninitialized variables
before.  When I introduced support for aggregating multiple uses into
a single bit-field, I extended that logic to handle the scalarized
bit-fields, but I didn't realize it was necessary to further extend it
to deal with the entire variable as well.

This patch fixes that.  Jakub gave it a round of testing (thanks!) and
confirmed no regressions.

The patch also separates the folding from the assignment building
shortly thereafter.  I think it's more readable after the change, but
I don't feel strongly about it.


Ok to install?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-sra-pr38271-no-uninit-warning.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081210/0a16d444/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


More information about the Gcc-patches mailing list