diff options
Diffstat (limited to 'gcc-4.8/gcc/testsuite/c-c++-common/torture')
-rw-r--r-- | gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-1.c | 29 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-2.c | 21 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/c-c++-common/torture/pr60026.c | 28 |
3 files changed, 78 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-1.c b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-1.c new file mode 100644 index 000000000..175629fec --- /dev/null +++ b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +struct S0 +{ + int f; +}; + +struct S1 +{ + struct S0 f1; + volatile int f2; +}; + +struct S2 +{ + struct S1 g; +} a, b; + +static int *c[1][2] = {{0, (int *)&a.g.f2}}; +static int d; + +int +main () +{ + for (d = 0; d < 1; d++) + for (b.g.f1.f = 0; b.g.f1.f < 1; b.g.f1.f++) + *c[b.g.f1.f][d + 1] = 0; + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-2.c b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-2.c new file mode 100644 index 000000000..767798806 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr58794-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +struct S +{ + volatile int f; +} a; + +unsigned int b; + +static int *c[1][2] = {{0, (int *)&a.f}}; +static unsigned int d; + +int +main () +{ + for (; d < 1; d++) + for (; b < 1; b++) + *c[b][d + 1] = 0; + + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr60026.c b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr60026.c new file mode 100644 index 000000000..1cc5f55a4 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/c-c++-common/torture/pr60026.c @@ -0,0 +1,28 @@ +/* PR ipa/60026 */ +/* { dg-do compile } */ + +struct S { int f; } a; + +__attribute__((optimize (0))) +struct S foo (int x, struct S y) +{ + int b = y.f; + return a; +} + +void +bar () +{ + while (a.f) + { + struct S c = {0}; + foo (0, c); + } +} + +int +main () +{ + bar (); + return 0; +} |