diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr68963.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr68963.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr68963.c b/gcc/testsuite/gcc.dg/torture/pr68963.c new file mode 100644 index 00000000000..c83b543fa03 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68963.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ + +static const float a[3] = { 1, 2, 3 }; +int b = 3; + +__attribute__((noinline, noclone)) void +bar (int x) +{ + if (x != b++) + __builtin_abort (); +} + +void +foo (float *x, int y) +{ + int i; + for (i = 0; i < 2 * y; ++i) + { + if (i < y) + x[i] = a[i]; + else + { + bar (i); + x[i] = a[i - y]; + } + } +} + +int +main () +{ + float x[10]; + unsigned int i; + for (i = 0; i < 10; ++i) + x[i] = 1337; + foo (x, 3); + for (i = 0; i < 10; ++i) + if (x[i] != (i < 6 ? (i % 3) + 1 : 1337)) + __builtin_abort (); + return 0; +} |