Default to -fstrict-volatile-bitfields for ARM EABI

Jie Zhang jie@codesourcery.com
Thu Sep 2 17:03:00 GMT 2010


On 09/03/2010 12:48 AM, Joseph S. Myers wrote:
> On Fri, 3 Sep 2010, Jie Zhang wrote:
>
>> On 09/02/2010 11:55 PM, Joseph S. Myers wrote:
>>> On Thu, 2 Sep 2010, Jie Zhang wrote:
>>>
>>>> 20010518-2.c: In function 'main':
>>>> 20010518-2.c:34:21: warning: mis-aligned access used for structure member
>>>> [-fstrict-volatile-bitfields]
>>>> 20010518-2.c:34:21: note: When a volatile object spans multiple type-sized
>>>> locations, the compiler must choose between using a single mis-aligned
>>>> access
>>>> to preserve the volatility, or using multiple aligned accesses to avoid
>>>> runtime faults.  This code may fail at runtime if the hardware does not
>>>> allow
>>>> this access.
>>>>
>>>> So I think this test should be disabled for all targets which default to
>>>> -fstrict-volatile-bitfields. If this is what we should do, I will update
>>>> my
>>>> patch to disable it for all such targets.
>>>
>>> Why should it be disabled?  It should still execute OK; that's just a
>>> warning, and warnings aren't meant to cause c-torture tests to fail.
>>>
>> But GCC chooses to preserve the volatility in this case. It tries to use "ldr"
>> to access unaligned address. This test fails at runtime on arm-none-eabi
>> target at any optimization levels.
>
> That sounds like a bug in this option.  The test looks like perfectly
> valid GNU C to me and should not fail depending on the target.
>
Hmmm, there are no bitfields in the test case, but 
-fstrict-volatile-bitfields affected it. I will take a look tomorrow.


-- 
Jie Zhang
CodeSourcery



More information about the Gcc-patches mailing list