aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/ssp-strong-reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/ssp-strong-reg.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/ssp-strong-reg.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/ssp-strong-reg.c b/gcc/testsuite/gcc.target/i386/ssp-strong-reg.c
new file mode 100644
index 00000000000..9fe56641b9e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ssp-strong-reg.c
@@ -0,0 +1,19 @@
+/* Test that structs returned in registers do not lead to
+ instrumentation with -fstack-protector-strong. */
+
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-O2 -fstack-protector-strong" } */
+
+struct S {
+ int a;
+ int b;
+};
+
+struct S f (void);
+
+int g (void)
+{
+ return f ().a;
+}
+
+/* { dg-final { scan-assembler-times "stack_chk_fail" 0 } } */