summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ssp-1.c
diff options
context:
space:
mode:
authorechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-14 21:11:20 +0000
committerechristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-14 21:11:20 +0000
commit054d18868e89cefe8b8b87e5b28f9b6a6cc33b15 (patch)
tree2b986f6189a60e2081319162ce5e7561a2f2efbc /gcc/testsuite/gcc.dg/ssp-1.c
parent735630ef5d264e0535d02bec3af5fd54f3f79f7b (diff)
downloadgcc-054d18868e89cefe8b8b87e5b28f9b6a6cc33b15.tar.gz
2007-03-14 Eric Christopher <echristo@apple.com>
* gcc.dg/ssp-1.c: New. * gcc.dg/ssp-2.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122932 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/ssp-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/ssp-1.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ssp-1.c b/gcc/testsuite/gcc.dg/ssp-1.c
new file mode 100644
index 00000000000..c839a5d3ae2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ssp-1.c
@@ -0,0 +1,21 @@
+/* { dg-do run { target native } } */
+/* { dg-options "-fstack-protector" } */
+#include <stdlib.h>
+
+static void
+__stack_chk_fail (void)
+{
+ exit (0); /* pass */
+}
+
+int main ()
+{
+ int i;
+ char foo[255];
+
+ // smash stack
+ for (i = 0; i <= 400; i++)
+ foo[i] = 42;
+
+ return 1; /* fail */
+}