From: rsandifo Date: Fri, 2 Sep 2005 12:24:21 +0000 (+0000) Subject: PR c/22061 X-Git-Tag: upstream/4.9.2~58888 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=81d31c3011603911d1b5cdcb3ebd106789ad384e;p=platform%2Fupstream%2Flinaro-gcc.git PR c/22061 * gcc.c-torture/execute/pr22061-1.c, * gcc.c-torture/execute/pr22061-2.c, * gcc.c-torture/execute/pr22061-3.c, * gcc.c-torture/execute/pr22061-4.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103772 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e8fee8..515bd26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2005-09-02 Richard Sandiford + + PR c/22061 + * gcc.c-torture/execute/pr22061-1.c, + * gcc.c-torture/execute/pr22061-2.c, + * gcc.c-torture/execute/pr22061-3.c, + * gcc.c-torture/execute/pr22061-4.c: New tests. + 2005-09-01 Craig Rodrigues * gcc.dg/Wredundant-decls-2.c: New test to check that diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c new file mode 100644 index 0000000..65375fe --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-1.c @@ -0,0 +1,16 @@ +int N = 1; +void foo() {} /* Necessary to trigger the original ICE. */ +void bar (char a[2][N]) { a[1][0] = N; } +int +main (void) +{ + void *x; + + N = 4; + x = alloca (2 * N); + memset (x, 0, 2 * N); + bar (x); + if (N[(char *) x] != N) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c new file mode 100644 index 0000000..4e1be8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-2.c @@ -0,0 +1,7 @@ +int *x; +static void bar (char a[2][(*x)++]) {} +int +main (void) +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c new file mode 100644 index 0000000..a805948 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-3.c @@ -0,0 +1,18 @@ +void +bar (int N) +{ + int foo (char a[2][++N]) { N += 4; return sizeof (a[0]); } + if (foo (0) != 2) + abort (); + if (foo (0) != 7) + abort (); + if (N != 11) + abort (); +} + +int +main() +{ + bar (1); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c b/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c new file mode 100644 index 0000000..38ce3e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22061-4.c @@ -0,0 +1,22 @@ +void +bar (int N) +{ + void foo (int a[2][N++]) {} + int a[2][N]; + foo (a); + int b[2][N]; + foo (b); + if (sizeof (a) != sizeof (int) * 2 * 1) + abort (); + if (sizeof (b) != sizeof (int) * 2 * 2) + abort (); + if (N != 3) + abort (); +} + +int +main (void) +{ + bar (1); + exit (0); +}