From c49dac0d87e288f3f0de73006f1d13ad930ff945 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 14 Dec 2017 15:18:16 +0000 Subject: [PATCH] re PR tree-optimization/66974 (-Warray-bounds false positive with -O3) 2017-12-14 Richard Biener PR tree-optimization/66974 * gcc.dg/Warray-bounds-24.c: New testcase. From-SVN: r255642 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/Warray-bounds-24.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Warray-bounds-24.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 981c3a2771f..a053fcba4d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-14 Richard Biener + + PR tree-optimization/66974 + * gcc.dg/Warray-bounds-24.c: New testcase. + 2017-12-14 Richard Biener PR tree-optimization/65258 diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-24.c b/gcc/testsuite/gcc.dg/Warray-bounds-24.c new file mode 100644 index 00000000000..35631737647 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-24.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -Warray-bounds" } */ + +int foo(unsigned order) +{ + int c[3] = {1, 2, 3}; + unsigned i, j; + for (i = 1; i < order; i++) { + for (j = 0; j < i / 2; j++) { + c[j] += c[i] * c[i-j-1]; /* { dg-bogus "array bounds" } */ + c[i-j-1] += c[i] * c[j]; /* { dg-bogus "array bounds" } */ + } + } + return c[0]; +} -- 2.30.2