aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c
new file mode 100644
index 000000000..d293f05c4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20000801-4.c
@@ -0,0 +1,30 @@
+/* Origin: PR c/128 from Martin Sebor <sebor@roguewave.com>, adapted
+ as a testcase by Joseph Myers <jsm28@cam.ac.uk>.
+*/
+/* Character arrays initialized by a string literal must have
+ uninitialized elements zeroed. This isn't clear in the 1990
+ standard, but was fixed in TC2 and C99; see DRs #060, #092.
+*/
+extern void abort (void);
+
+int
+foo (void)
+{
+ char s[2] = "";
+ return 0 == s[1];
+}
+
+char *t;
+
+int
+main (void)
+{
+ {
+ char s[] = "x";
+ t = s;
+ }
+ if (foo ())
+ exit (0);
+ else
+ abort ();
+}