Commit 369695b9 by Andrew Stubbs Committed by Andrew Stubbs

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
parent 5704db33
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> 2014-12-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63985 PR c++/63985
......
...@@ -15,8 +15,11 @@ foo (int p) ...@@ -15,8 +15,11 @@ foo (int p)
(p (p
? array1[i] /* { dg-message "note: possible undefined statement is here" } */ ? array1[i] /* { dg-message "note: possible undefined statement is here" } */
: array2[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 < 100; /* { dg-warning "loop exit may only be reached after undefined behavior" } */
i++) i++)
doSomething(array1[i]); {
if (i >= 5) /* { dg-warning "loop exit may only be reached after undefined behavior" } */
break;
doSomething(array1[i]);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment