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

Florian Klämpfl florian at freepascal.org
Tue Nov 8 20:21:21 CET 2016

Am 07.11.2016 um 03:42 schrieb Gennady Agranov:
> 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

While this is possible, if you - as said below - use packrecords 1, you will get a hint on every use
of such a cardinal as the compiler normally does not know the final address of a variable in a
program but only its alignment requirements. So even if a cardinal is the first element of a such a
record, the compiler cannot assume that this field is actually properly aligned because packrecords
1 relaxes also the alignment requirements of the whole record, so the record itself might be start
at an unaligned address. This makes imo such a hint useless. Or what are the conditions when you
want to emit the hint?

> 2. All our units use {$PACKRECORDS 1} in order to be layout compatible with Delphi and we always can
> add padding or change the field order - if only compiler warned us that field is not properly
> aligned for the target platform...
> 3. And a separate question - if the bug is closed - is there any way to add a note to it?

You can reopen it to add the note.

More information about the fpc-devel mailing list