summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu89-init-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gnu89-init-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/gnu89-init-4.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gnu89-init-4.c b/gcc/testsuite/gcc.dg/gnu89-init-4.c
new file mode 100644
index 000000000..15e9cdb35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu89-init-4.c
@@ -0,0 +1,12 @@
+/* Test for GNU extensions to compound literals are giving the correct array bounds */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89 -W -Wall -O2" } */
+
+int a[] = (int[4]){1, 1, 2};
+int f(void)
+{
+ int sum = 0; int i;
+ for(i = 0;i<4;i++)
+ sum = a[i];
+ return sum;
+}