aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu99-init-1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-01-27 21:33:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2001-01-27 21:33:54 +0100
commit940ff66d0ba2ba6166a9788172385415663c622c (patch)
tree0fab0c3de38f363189bc2aeb562cad8a557ac642 /gcc/testsuite/gcc.dg/gnu99-init-1.c
parentde1b33ddc0675f85ca11c28c735408794d133803 (diff)
downloadgcc-940ff66d0ba2ba6166a9788172385415663c622c.zip
gcc-940ff66d0ba2ba6166a9788172385415663c622c.tar.gz
gcc-940ff66d0ba2ba6166a9788172385415663c622c.tar.bz2
c-typeck.c (struct constructor_stack): Add range_stack member.
* c-typeck.c (struct constructor_stack): Add range_stack member. (really_start_incremental_init): Clear it. (push_init_level): Save constructor_range_stack and clear it if pushing explicit braces. (pop_init_level): abort if constructor_range_stack is non-zero at explicit closing brace. Restore saved constructor_range_stack if not implicit. * gcc.dg/gnu99-init-1.c: Add 3 more designated range initializer tests. From-SVN: r39302
Diffstat (limited to 'gcc/testsuite/gcc.dg/gnu99-init-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/gnu99-init-1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gnu99-init-1.c b/gcc/testsuite/gcc.dg/gnu99-init-1.c
index c78f1764..9c22c90 100644
--- a/gcc/testsuite/gcc.dg/gnu99-init-1.c
+++ b/gcc/testsuite/gcc.dg/gnu99-init-1.c
@@ -19,6 +19,11 @@ struct H m = { .J = {}, 3 };
struct I { int J; int K[3]; int L; };
struct M { int N; struct I O[3]; int P; };
struct M n[] = { [0 ... 5].O[1 ... 2].K[0 ... 1] = 4, 5, 6, 7 };
+struct M o[] = { [0 ... 5].O = { [1 ... 2].K[0 ... 1] = 4 },
+ [5].O[2].K[2] = 5, 6, 7 };
+struct M p[] = { [0 ... 5].O[1 ... 2].K = { [0 ... 1] = 4 },
+ [5].O[2].K[2] = 5, 6, 7 };
+int q[3][3] = { [0 ... 1] = { [1 ... 2] = 23 }, [1][2] = 24 };
int main (void)
{
@@ -58,5 +63,15 @@ int main (void)
}
if (n[5].O[2].K[2] != 5 || n[5].O[2].L != 6 || n[5].P != 7)
abort ();
+ if (memcmp (n, o, sizeof (n)) || sizeof (n) != sizeof (o))
+ abort ();
+ if (memcmp (n, p, sizeof (n)) || sizeof (n) != sizeof (p))
+ abort ();
+ if (q[0][0] || q[0][1] != 23 || q[0][2] != 23)
+ abort ();
+ if (q[1][0] || q[1][1] != 23 || q[1][2] != 24)
+ abort ();
+ if (q[2][0] || q[2][1] || q[2][2])
+ abort ();
exit (0);
}