From 63fd708bd182b50b37b9f64fa330458c9109380a Mon Sep 17 00:00:00 2001 From: Alexander Ivchenko Date: Wed, 28 Jan 2015 14:16:01 +0300 Subject: [4.9] Fix bogus warnings about array-bounds. 2015-01-28 Ilya Enkovich PR tree-optimization/64277 * tree-ssa-loop-niter.c (record_nonwrapping_iv): Use base range info when possible to refine estimation. 2015-01-27 Richard Biener PR tree-optimization/56273 PR tree-optimization/59124 PR tree-optimization/64277 * tree-vrp.c (vrp_finalize): Emit array-bound warnings only from the first VRP pass. * g++.dg/warn/Warray-bounds-6.C: New testcase. * gcc.dg/Warray-bounds-12.c: Likewise. * gcc.dg/Warray-bounds-13.c: Likewise. Change-Id: I175b420a4c8150ecf986d477e4c51cbbff276c82 Signed-off-by: Alexander Ivchenko --- .../gcc/testsuite/g++.dg/warn/Warray-bounds-6.C | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C (limited to 'gcc-4.9/gcc/testsuite/g++.dg/warn') diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C new file mode 100644 index 000000000..f2e5f2f59 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-O3 -Warray-bounds" } + +struct type { + bool a, b; + bool get_b() { return b; } +}; + +type stuff[9u]; + +void bar(); + +void foo() +{ + for(unsigned i = 0u; i < 9u; i++) + { + if(!stuff[i].a) + continue; + + bar(); + + for(unsigned j = i + 1u; j < 9u; j++) + if(stuff[j].a && stuff[j].get_b()) // { dg-bogus "above array bounds" } + return; + } +} -- cgit v1.2.3