[fpc-devel] Data alignment feature

J. Gareth Moreton gareth at moreton-family.com
Sat Jan 27 18:11:02 CET 2018


On Sat 27/01/18 16:33 , Jonas Maebe jonas at freepascal.org sent:
> 
> 
> Adriaan van Os wrote:
> 
> > J. Gareth Moreton wrote:
> 
> > 
> 
> >> For Florian's fix though, any local
> variables are given the correct
> >> alignment on the stack, even if the stack is
> unaligned beforehand.
> > 
> 
> > That's good news. Can you give a small code
> example ?
> 
> 
> The x86-64 ABIs mandate 16 byte alignment of the stack after the
> 
> compiler-generated entry code.

That is true, but it's more the issue of, say, declaring a 4-byte variable and then a variable that must be 
aligned to a 16-byte boundary. Florian's test at tests/test/cg/tm128.pp confirms to see if the stack pointer 
is correctly decremented by 12 (or whatever the result of 16 minus the size of the previous variable) before 
reserving space for the aligned type.



More information about the fpc-devel mailing list