On Mon, Jan 6, 2020 at 2:18 PM Olivier Hainque <hain...@adacore.com> wrote:
>
> Hello,
>
> The aarch64 testsuite features a few tests for
> the stack-clash-protection facility, all using "alloca"
> after an #include <alloca.h>.
>
> The use of alloca.h causes the tests to fail on
> target systems not providing that header, such as some
> variants of VxWorks.
>
> My understanding is that the tests really depend on
> the alloca functionality, not on alloca.h in particular.
>
> This patch is a proposal to modify the tests to
> use __builtin_alloca instead, as done in some other
> places in the testsuite.
>
> This cures the failures on VxWorks and bootstrap+regtest
> fine on aarch64 linux.
>
> Ok to commit ?

Just one small suggestion:
Instead of:
-  char* pStr = alloca(SIZE);
+  char* pStr = __builtin_alloca(SIZE);

Why not just do:
-#include <alloca.h>
+#define alloca __builtin_alloca

Thanks,
Andrew Pinski


>
> Thanks in advance!
>
> Best Regards,
>
> Olivier
>
>
> 2020-01-06  Olivier Hainque  <hain...@adacore.com>
>         Alexandre Oliva  <ol...@adacore.com>
>
>         * gcc.target/aarch64/stack-check-alloca.h: Remove
>         #include alloca.h.
>         (f_caller): Use __builtin_alloca instead of alloca.
>         * gcc.target/aarch64/stack-check-alloca-1.c: Add
>         { dg-require-effective-target alloca }.
>         * gcc.target/aarch64/stack-check-alloca-2.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-3.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-4.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-5.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-6.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-7.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-8.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-9.c: Likewise.
>         * gcc.target/aarch64/stack-check-alloca-10.c: Likewise.
>

Reply via email to