Fix undefined-loop-2.c test case.

2014-12-24  Andrew Stubbs  <ams@codesourcery.com>

	PR testsuite/64032
	* gcc.dg/undefined-loop-2.c: Don't allow GCC to optimize away the
	loop exits too early.

From-SVN: r219059
This commit is contained in:
Andrew Stubbs 2014-12-24 14:27:06 +00:00 committed by Andrew Stubbs
parent 5704db3364
commit 369695b99d
2 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2014-12-24 Andrew Stubbs <ams@codesourcery.com>
PR testsuite/64032
* gcc.dg/undefined-loop-2.c: Don't allow GCC to optimize away the
loop exits too early.
2014-12-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63985

View file

@ -15,8 +15,11 @@ foo (int p)
(p
? array1[i] /* { dg-message "note: possible undefined statement is here" } */
: array2[i]) /* { dg-message "note: possible undefined statement is here" } */
&& i < 5 /* { dg-warning "loop exit may only be reached after undefined behavior" } */
&& i < 100; /* { dg-warning "loop exit may only be reached after undefined behavior" } */
i++)
doSomething(array1[i]);
{
if (i >= 5) /* { dg-warning "loop exit may only be reached after undefined behavior" } */
break;
doSomething(array1[i]);
}
}