[fpc-devel] alignment warnings
Mark Morgan Lloyd
markMLl.fpc-devel at telemetry.co.uk
Fri Sep 30 12:39:08 CEST 2011
Henry Vermaak wrote:
> On 30/09/11 10:52, Martin wrote:
>> On 30/09/2011 10:44, Henry Vermaak wrote:
>>> Hi list
>>>
>>> Thinking more about the alignment problems on arm and elsewhere, I was
>>> wondering how hard it would be to implement something like gcc's
>>> -Wcast-align. Here's a description from the man page:
>>>
>>> Warn whenever a pointer is cast such that the required alignment of
>>> the target is increased. For example, warn if a "char *" is cast to an
>>> "int *" on machines where integers can only be accessed at two- or
>>> four-byte boundaries.
>>
>> Why limit it to "on machines where ... can only be accessed at ...
>> boundaries".
>> If code is written for multiply platforms, then the implementor may be
>> on a machine where the cast is allowed, and needs no warning, but soon
>> as the code is compiled on a different architecture, the warnings come
>> up.
>> It would be good, if one could also enable warnings for code, that may
>> have issues on other platforms
>
> Because you may be writing code that's specific to a platform? I guess
> you can have another option that will warn on all machines.
I think we need to take into account the particular case of ARM, where
some implementations are stricter than others but there's no
indication/test in the ABI or loader.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-devel
mailing list