Cleanup the AArch64 testsuite when stack-clash is on.
authorTamar Christina <tamar.christina@arm.com>
Mon, 1 Oct 2018 13:05:30 +0000 (13:05 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Mon, 1 Oct 2018 13:05:30 +0000 (13:05 +0000)
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
gcc/testsuite/c-c++-common/ubsan/vla-1.c
gcc/testsuite/gcc.dg/params/blocksort-part.c
gcc/testsuite/gcc.dg/pr82788.c
gcc/testsuite/gcc.dg/stack-check-10.c
gcc/testsuite/gcc.dg/stack-check-5.c
gcc/testsuite/gcc.dg/stack-check-6a.c
gcc/testsuite/gcc.target/aarch64/stack-check-12.c
gcc/testsuite/gcc.target/aarch64/subsp.c
gcc/testsuite/lib/target-supports.exp

index 0252a1dfac97b1cd8a9148cf04d62ce5c8e14712..e8ba7fc66597a41e68c875342f1b4130e82410f5 100644 (file)
@@ -1,3 +1,19 @@
+2018-10-01  Tamar Christina  <tamar.christina@arm.com>
+
+       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  <tamar.christina@arm.com>
 
        PR target/86486
index 52ade3aab7566dce3ca7ef931ac65895005d5e13..c97465edae195442a71ee66ab25015a2ac4fc8fc 100644 (file)
@@ -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;
index a9154f2e61ccd21b60153f20be3891b988f9ef2c..1e677878e7bd9c68b026f8c72b0de9f01e15459c 100644 (file)
@@ -1,3 +1,4 @@
+/* { dg-skip-if "AArch64 does not support these bounds." { aarch64*-*-* } { "--param stack-clash-protection-*" } } */
 
 /*-------------------------------------------------------------*/
 /*--- Block sorting machinery                               ---*/
index a8f628fd7f66c3e56739f6ff491df38b23f4d4df..41c442f61a625c8b350e1e4c870a98d86b167031 100644 (file)
@@ -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;}
index a86956ad6925464e4a938a33e609fae5004201c7..2f5a090cb7a4ed6d2e6e4317492150a348a326ab 100644 (file)
@@ -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*-*-* } } } } */
index 604fa3cf6c5b502f74c1e3497b3b8d72a15bb3ea..0243147939c10e8f4632520b12714724af85b332 100644 (file)
@@ -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.
index 8fb9c621585957a85877ebadfbc4a8daabe4311c..68dd9bc48a0c26ecb84ddd2c09b8aa74d3276695 100644 (file)
@@ -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"
index 4e3abcbcef2eb216be9f0e01b4f1713c33f8b0b8..be5a57a9ec6bb0a866ab57571d06912731d76c7a 100644 (file)
@@ -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);
 }
 
index 70d848c59d1f1e4df4314ca012c7a5d9d3b91ebc..6ef6b2c90ae694055749a94b68cbba5ee4aea882 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options "-O" } */
+/* { dg-options "-O -fno-stack-clash-protection" } */
 
 int foo (void *);
 
index d741583c6f6f3546c5830bf4a57d18c992e9e9af..b82c332ca8b09383fdb1dbb185c53ebd8bc8679e 100644 (file)
@@ -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