Fix __attribute__((force_align_arg_pointer)) misalignment bug
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 19 01:33:40 PDT 2018
Hej Henrik,
On Thu, 19 Apr 2018, Henrik Gramner via cfe-commits wrote:
> 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.
You need to update the corresponding tests as well, run "ninja
check-clang" to see that this change alters the output from
test/CodeGen/function-attributes.c, breaking that test. You at least need
to update it with how this patch changes the behaviour of the existing
tests, but ideally also add a new test case (either in this file or as a
completely new file) for the specific usecase that you had in mind (32
byte alignment).
For better visibility, I'd also recommend uploading the patch at
https://reviews.llvm.org (even though the official guidelines say this is
optional). I don't know off-hand who would be best to add as reviewer for
it though (I'm not authoritative in this area)...
// Martin
More information about the cfe-commits
mailing list