Fix __attribute__((force_align_arg_pointer)) misalignment bug

Henrik Gramner via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 18 18:24:31 PDT 2018


The force_align_arg_pointer attribute was using a hardcoded 16-byte
alignment value which in combination with -mstack-alignment=32 (or
larger) would produce a misaligned stack which could result in crashes
when accessing stack buffers using aligned AVX load/store
instructions.

The attached patch fixes the issue by using the "stackrealign"
function attribute instead of using a hardcoded 16-byte alignment.

Tested on 64-bit Linux and it works as far as I can see, unable to
test on anything else though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: force_align_arg_pointer.diff
Type: application/octet-stream
Size: 2167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180419/3c2a43b8/attachment.obj>


More information about the cfe-commits mailing list