From: Andrew Stubbs Date: Wed, 24 Dec 2014 14:27:06 +0000 (+0000) Subject: Fix undefined-loop-2.c test case. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=369695b99d6eb0382c32ad442a55a5d3e656069a;p=gcc.git Fix undefined-loop-2.c test case. 2014-12-24 Andrew Stubbs PR testsuite/64032 * gcc.dg/undefined-loop-2.c: Don't allow GCC to optimize away the loop exits too early. From-SVN: r219059 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b74165e6eae..ef6a8aa3c2d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-12-24 Andrew Stubbs + + 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 PR c++/63985 diff --git a/gcc/testsuite/gcc.dg/undefined-loop-2.c b/gcc/testsuite/gcc.dg/undefined-loop-2.c index dbea62cf20b..7ab37f4e9e1 100644 --- a/gcc/testsuite/gcc.dg/undefined-loop-2.c +++ b/gcc/testsuite/gcc.dg/undefined-loop-2.c @@ -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]); + } }