From c98f502f0ab9e51357665d7afcad724feee6088b Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 1 Oct 2018 13:05:30 +0000 Subject: [PATCH] Cleanup the AArch64 testsuite when stack-clash is on. This patch cleans up the testsuite when a run is done with stack clash protection turned on. Concretely this switches off -fstack-clash-protection for a couple of tests: * assembler scan: some tests are quite fragile in that they check for exact assembly output, e.g. check for exact amount of sub etc. These won't match now. * vla: Some of the ubsan tests negative array indices. Because the arrays weren't used before the incorrect $sp wouldn't have been used. The correct value is restored on ret. Now however we probe the $sp which causes a segfault. * params: When testing the parameters we have to skip these on AArch64 because of our custom constraints on them. We already test them separately so this isn't a loss. Note that the testsuite is not entire clean due to gdb failure caused by alloca with stack clash. On AArch64 we output an incorrect .loc directive, but this is already the case with the current implementation in GCC and is a bug unrelated to this patch series. gcc/testsuite/ PR target/86486 * gcc.dg/pr82788.c: Skip for AArch64. * gcc.dg/guality/vla-1.c: Turn off stack-clash. * gcc.target/aarch64/subsp.c: Likewise. * gcc.dg/params/blocksort-part.c: Skip stack-clash checks on AArch64. * gcc.dg/stack-check-10.c: Add AArch64 specific checks. * gcc.dg/stack-check-12.c: ILP32 fixup. * gcc.dg/stack-check-5.c: Add AArch64 specific checks. * gcc.dg/stack-check-6a.c: Skip on AArch64, we don't support this. * testsuite/lib/target-supports.exp (check_effective_target_frame_pointer_for_non_leaf): AArch64 does not require frame pointer for non-leaf functions. From-SVN: r264754 --- gcc/testsuite/ChangeLog | 16 ++++++++++++++++ gcc/testsuite/c-c++-common/ubsan/vla-1.c | 2 +- gcc/testsuite/gcc.dg/params/blocksort-part.c | 1 + gcc/testsuite/gcc.dg/pr82788.c | 1 + gcc/testsuite/gcc.dg/stack-check-10.c | 1 + gcc/testsuite/gcc.dg/stack-check-5.c | 4 +++- gcc/testsuite/gcc.dg/stack-check-6a.c | 1 + .../gcc.target/aarch64/stack-check-12.c | 8 +++++--- gcc/testsuite/gcc.target/aarch64/subsp.c | 2 +- gcc/testsuite/lib/target-supports.exp | 4 ---- 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0252a1dfac9..e8ba7fc6659 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2018-10-01 Tamar Christina + + PR target/86486 + * gcc.dg/pr82788.c: Skip for AArch64. + * gcc.dg/guality/vla-1.c: Turn off stack-clash. + * gcc.target/aarch64/subsp.c: Likewise. + * gcc.dg/params/blocksort-part.c: Skip stack-clash checks + on AArch64. + * gcc.dg/stack-check-10.c: Add AArch64 specific checks. + * gcc.dg/stack-check-12.c: ILP32 fixup. + * gcc.dg/stack-check-5.c: Add AArch64 specific checks. + * gcc.dg/stack-check-6a.c: Skip on AArch64, we don't support this. + * testsuite/lib/target-supports.exp + (check_effective_target_frame_pointer_for_non_leaf): AArch64 does not + require frame pointer for non-leaf functions. + 2018-10-01 Tamar Christina PR target/86486 diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc/testsuite/c-c++-common/ubsan/vla-1.c index 52ade3aab75..c97465edae1 100644 --- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -fno-stack-clash-protection" } */ typedef long int V; int x = -1; diff --git a/gcc/testsuite/gcc.dg/params/blocksort-part.c b/gcc/testsuite/gcc.dg/params/blocksort-part.c index a9154f2e61c..1e677878e7b 100644 --- a/gcc/testsuite/gcc.dg/params/blocksort-part.c +++ b/gcc/testsuite/gcc.dg/params/blocksort-part.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "AArch64 does not support these bounds." { aarch64*-*-* } { "--param stack-clash-protection-*" } } */ /*-------------------------------------------------------------*/ /*--- Block sorting machinery ---*/ diff --git a/gcc/testsuite/gcc.dg/pr82788.c b/gcc/testsuite/gcc.dg/pr82788.c index a8f628fd7f6..41c442f61a6 100644 --- a/gcc/testsuite/gcc.dg/pr82788.c +++ b/gcc/testsuite/gcc.dg/pr82788.c @@ -1,4 +1,5 @@ /* { dg-do run } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-probe-interval=10 --param stack-clash-protection-guard-size=12" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "AArch64 does not support this interval." { aarch64*-*-* } } */ int main() { int a[1442]; return 0;} diff --git a/gcc/testsuite/gcc.dg/stack-check-10.c b/gcc/testsuite/gcc.dg/stack-check-10.c index a86956ad692..2f5a090cb7a 100644 --- a/gcc/testsuite/gcc.dg/stack-check-10.c +++ b/gcc/testsuite/gcc.dg/stack-check-10.c @@ -39,3 +39,4 @@ f3 (void) need a frame pointer. Otherwise neither should. */ /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe small stack adjustment in prologue" 2 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c index 604fa3cf6c5..0243147939c 100644 --- a/gcc/testsuite/gcc.dg/stack-check-5.c +++ b/gcc/testsuite/gcc.dg/stack-check-5.c @@ -66,7 +66,9 @@ f3 (void) /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 4 "pro_and_epilogue" { target { ! frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash no frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ /* { dg-final { scan-rtl-dump-times "Stack clash frame pointer needed" 2 "pro_and_epilogue" { target { frame_pointer_for_non_leaf } } } } */ - +/* AArch64 won't require a probe here due to the allocation amount being less than 1KB. */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe small stack adjustment in prologue" 3 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ +/* { dg-final { scan-rtl-dump-times "Stack clash no probe no stack adjustment in prologue" 1 "pro_and_epilogue" { target { aarch64*-*-* } } } } */ /* We have selected the size of the array in f2/f3 to be large enough to not live in the red zone on targets that support it. diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c index 8fb9c621585..68dd9bc48a0 100644 --- a/gcc/testsuite/gcc.dg/stack-check-6a.c +++ b/gcc/testsuite/gcc.dg/stack-check-6a.c @@ -5,6 +5,7 @@ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=16" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ +/* { dg-skip-if "" { aarch64*-*-* } } */ #include "stack-check-6.c" diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c index 4e3abcbcef2..be5a57a9ec6 100644 --- a/gcc/testsuite/gcc.target/aarch64/stack-check-12.c +++ b/gcc/testsuite/gcc.target/aarch64/stack-check-12.c @@ -2,12 +2,14 @@ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-asynchronous-unwind-tables -fno-unwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ -extern void arf (unsigned long int *, unsigned long int *); +typedef unsigned __attribute__((mode(DI))) uint64_t; + +extern void arf (uint64_t *, uint64_t *); void frob () { - unsigned long int num[10000]; - unsigned long int den[10000]; + uint64_t num[10000]; + uint64_t den[10000]; arf (den, num); } diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c index 70d848c59d1..6ef6b2c90ae 100644 --- a/gcc/testsuite/gcc.target/aarch64/subsp.c +++ b/gcc/testsuite/gcc.target/aarch64/subsp.c @@ -1,4 +1,4 @@ -/* { dg-options "-O" } */ +/* { dg-options "-O -fno-stack-clash-protection" } */ int foo (void *); diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d741583c6f6..b82c332ca8b 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8396,10 +8396,6 @@ proc check_effective_target_supports_stack_clash_protection { } { # Return 1 if the target creates a frame pointer for non-leaf functions # Note we ignore cases where we apply tail call optimization here. proc check_effective_target_frame_pointer_for_non_leaf { } { - if { [istarget aarch*-*-*] } { - return 1 - } - # Solaris/x86 defaults to -fno-omit-frame-pointer. if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } { return 1 -- 2.30.2