From 7d8c27ffa274c9dcaecc29421e3dbec08077be72 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 4 Jul 2007 12:39:42 +0000 Subject: re PR tree-optimization/32500 (Loop optimization limits range to size of array used inside loop) 2007-07-04 Richard Guenther PR tree-optimization/32500 * gcc.c-torture/execute/pr32500.c: New testcase. From-SVN: r126316 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr32500.c | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr32500.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0c0745..261286e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2007-07-04 Richard Guenther + PR tree-optimization/32500 + * gcc.c-torture/execute/pr32500.c: New testcase. + +2007-07-04 Richard Guenther + PR tree-optimization/32482 * gcc.c-torture/compile/pr32482.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr32500.c b/gcc/testsuite/gcc.c-torture/execute/pr32500.c new file mode 100644 index 0000000..dae06ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr32500.c @@ -0,0 +1,26 @@ +extern void abort(void); +extern void exit(int); +void foo(int) __attribute__((noinline)); +void bar(void) __attribute__((noinline)); + +/* Make sure foo is not inlined or considered pure/const. */ +int x; +void foo(int i) { x = i; } +void bar(void) { exit(0); } + +int +main(int argc, char *argv[]) +{ + int i; + int numbers[4] = { 0xdead, 0xbeef, 0x1337, 0x4242 }; + + for (i = 1; i <= 12; i++) { + if (i <= 4) + foo(numbers[i]); + else if (i >= 7 && i <= 9) + bar(); + } + + abort(); +} + -- cgit v1.1