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: [PATCH] Fix another wrong-code bug with -fstrict-volatile-bitfields


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. 
 		 	   		  

Attachment: changelog-volatile-bitfields-1.txt
Description: Text document

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


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