gcc/gcc/testsuite/gcc.dg/Warray-bounds-12.c
Richard Biener f101c4b47a re PR tree-optimization/56273 (Bogus -Warray-bounds warning)
2015-01-27  Richard Biener  <rguenther@suse.de>

	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.

From-SVN: r220157
2015-01-27 09:49:29 +00:00

27 lines
450 B
C

/* { dg-do compile } */
/* { dg-options "-O3 -Warray-bounds" } */
/* { dg-additional-options "-mssse3" { target x86_64-*-* i?86-*-* } } */
void foo(short a[], short m)
{
int i, j;
int f1[10];
short nc;
nc = m + 1;
if (nc > 3)
{
for (i = 0; i <= nc; i++)
{
f1[i] = f1[i] + 1;
}
}
for (i = 0, j = m; i < nc; i++, j--)
{
a[i] = f1[i]; /* { dg-bogus "above array bounds" } */
a[j] = i;
}
return;
}