aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/array-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/array-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/array-4.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/array-4.c b/gcc/testsuite/gcc.dg/array-4.c
new file mode 100644
index 0000000..9396dec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/array-4.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "" } */
+
+/* Verify that GCC's extension to initialize a zero-length array
+ member works properly. */
+
+extern void abort(void);
+extern void exit(int);
+
+struct f { int w; int x[0]; } f = { 4, { 0, 1, 2, 3 } };
+
+int main()
+{
+ int i;
+ for (i = 0; i < f.w; ++i)
+ if (f.x[i] != i)
+ abort ();
+ exit(0);
+}