[fpc-devel] Can FPC at least give a hint/warning?

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Tue Nov 8 09:18:17 CET 2016

On 08/11/16 06:30, Dennis wrote:
> Gennady Agranov wrote:
>> Hi,
>> I have submitted a bug - http://bugs.freepascal.org/view.php?id=30872
>> (misaligned data exception on ARMv7)
>> And this big was resolved as "won't fix"
>> 1. I understand that one has to work really hard to encounter this bug
>> - and there are easy workarounds, but it there are also different ways
>> to resolve this bug - e.g. just giving a hint would suffice - IMHO
> a compiler warning or hint would be nice.

Alignment was a major issue back when SPARC was still a realistically 
viable platform.

The Solaris and C communities appeared to take the line that a correct 
compiler "could not" generate unaligned accesses, although they held off 
clarifying whether "could" in that context means "if it does it's an 
error" or "it must rearrange data to avoid an error".

I believe that Solaris and in some cases Linux can handle unaligned 
accesses in the kernel, although there's obviously a significant 
performance penalty.

Working on the principle that the FPC community would do well to avoid 
antagonising people with expectations derived from experience with other 
compilers and languages, I'd suggest that a warning when 
potentially-misaligned code is generated is in order.

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