bounced... again, without html.

Hi Richard,

while working on another bug in the area of   -fstrict-volatile-bitfields
I became aware of another example where   -fstrict-volatile-bitfields may 
generate
wrong code.   This is reproducible on a !STRICT_ALIGNMENT target like x86_64.

The problem is   that strict_volatile_bitfield_p tries to allow more than 
necessary  
if !STRICT_ALIGNMENT.    Everything works OK on ARM for instance.

If this function returns true, we may later call narrow_bit_field_mem, and  
the check in strict_volatile_bitfield_p should mirror the logic there:  
narrow_bit_field_mem just uses GET_MODE_BITSIZE (mode) and does not  
care about STRICT_ALIGNMENT, and in the end  *new_bitnum + bitsize may  
reach beyond the end of the region. This causes store_fixed_bit_field_1  
to silently fail to generate correct code.

The attached patch was   boot-strapped and
regression-tested on x86_64-linux-gnu.

OK for trunk and 4.9?


Thanks
Bernd. 
                                          
gcc:
2015-03-04  Bernd Edlinger  <bernd.edlin...@hotmail.de>

        * expmed.c (strict_volatile_bitfield_p): Don't return different
        results if !STRICT_ALIGNMENT.
        Use GET_MODE_BITSIZE instead of GET_MODE_ALIGNMENT here.

testsuite:
2015-03-04  Bernd Edlinger  <bernd.edlin...@hotmail.de>

        * gcc.dg/20150304-1.c: New test.

Attachment: patch-volatile-bitfields-1.diff
Description: Binary data

Reply via email to