diff mbox series

[committed] Avoid stack-clash tests which do not work with -fstack-protector

Message ID ce9cfd26-58e4-87e9-e218-60564861eb61@redhat.com
State New
Headers show
Series [committed] Avoid stack-clash tests which do not work with -fstack-protector | expand

Commit Message

Jeff Law Oct. 8, 2017, 3:45 p.m. UTC
Red Hat's internal GCC testing does runs with -fstack-protector.  This
exposed failures with a few of the stack clash protection tests.

I looked at all the failures.  In every case we were still getting
proper protection, but the addition of stack-protector code subtly
changes the code generation and in turn changes the decisions made by
the stack clash protection code.

For example, stack protector can add calls to functions that were
previously leafs.  That in turn breaks stack clash tests that assume the
compiled function was a leaf.  That also affects ports which eliminate
the frame pointer in a leaf, but keep the frame pointer for non-leafs.

Another good example is that stack protector on PPC changes frame growth
direction  (see rs6000.h/FRAME_GROWS_DOWNWARD).  That in turn causes the
ppc32 port to generate a small frame when previously it generated no
frame.  Since the tests expect no frame they fail.

I didn't see a good way to twiddle the expected output based on command
line flags.  So for now I've just disabled the 3 tests which are highly
sensitive to things that get tweaked by -fstack-protector enablement.

Installed on the trunk.

Jeff
commit b2d224b52ca221edb761af35bd1a81a5984c2d19
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Sun Oct 8 15:44:39 2017 +0000

            * gcc.dg/stack-check-5.c: Skip with -fstack-protector.
            * gcc.dg/stack-check-6.c: Likewise.
            * gcc.dg/stack-check-6a.c: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253527 138bc75d-0d04-0410-961f-82ee72b054a4
diff mbox series

Patch

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c80e4bd9ec..e7045e8cba8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@ 
+2017-10-03  Jeff Law  <law@redhat.com>
+
+	* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
+	* gcc.dg/stack-check-6.c: Likewise.
+	* gcc.dg/stack-check-6a.c: Likewise.
+
 2017-10-07  Michael Collison <michael.collison@arm.com>
 
 	* gcc.target/aarch64/var_shift_mask_2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c
index 3178f5d8ce5..850e023ea4e 100644
--- a/gcc/testsuite/gcc.dg/stack-check-5.c
+++ b/gcc/testsuite/gcc.dg/stack-check-5.c
@@ -1,6 +1,7 @@ 
 /* { dg-do compile } */
 /* { 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=12" } */
 /* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
 
 
 /* Otherwise the S/390 back-end might save the stack pointer in f2 ()
diff --git a/gcc/testsuite/gcc.dg/stack-check-6.c b/gcc/testsuite/gcc.dg/stack-check-6.c
index ad2021c9037..ab4b0e8894c 100644
--- a/gcc/testsuite/gcc.dg/stack-check-6.c
+++ b/gcc/testsuite/gcc.dg/stack-check-6.c
@@ -1,6 +1,7 @@ 
 /* { dg-do compile } */
 /* { 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=12" } */
 /* { dg-require-effective-target supports_stack_clash_protection } */
+/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */
 
 
 extern void foo (char *);
diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c
index 6f8e7128921..468d649a4fa 100644
--- a/gcc/testsuite/gcc.dg/stack-check-6a.c
+++ b/gcc/testsuite/gcc.dg/stack-check-6a.c
@@ -4,6 +4,8 @@ 
 /* { dg-do compile  } */
 /* { 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" } { "" } } */
+
 
 #include "stack-check-6.c"