http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54932
--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-11-18 14:33:49 UTC --- > ... in wich case could you, please, update the testcase to be valid and remove > the XFAIL I introduced? I cannot commit anything, but the XFAIL can be fixed in several ways: (1) keep the test, but restrict it to option -O0 (2) change the test along the following line to make it valid: --- ../_clean/gcc/testsuite/gfortran.dg/do_1.f90 2012-10-18 20:35:25.000000000 +0200 +++ gcc/testsuite/gfortran.dg/do_1.f90 2012-10-23 18:31:32.000000000 +0200 @@ -1,4 +1,4 @@ -! { dg-do run { xfail *-*-* } } +! { dg-do run } ! XFAIL is tracked in PR 54932 ! Program to check corner cases for DO statements. program do_1 @@ -7,18 +7,18 @@ program do_1 ! limit=HUGE(i), step 1 j = 0 - do i = HUGE(i) - 10, HUGE(i), 1 + do i = HUGE(i) - 11, HUGE(i) - 1, 1 j = j + 1 end do if (j .ne. 11) call abort ! limit=HUGE(i), step > 1 j = 0 - do i = HUGE(i) - 10, HUGE(i), 2 + do i = HUGE(i) - 11, HUGE(i) - 1, 2 j = j + 1 end do if (j .ne. 6) call abort j = 0 - do i = HUGE(i) - 9, HUGE(i), 2 + do i = HUGE(i) - 10, HUGE(i) - 1, 2 j = j + 1 end do if (j .ne. 5) call abort @@ -62,7 +62,7 @@ function test1(r, step) integer test1, r, step integer k, n k = 0 - do n = HUGE(n) - r, HUGE(n), step + do n = HUGE(n) - r - 1, HUGE(n) - 1, step k = k + 1 end do test1 = k (tested on darwin), (3) do (1) and add a new test along (2), (4) ... As asked in several other mails, would it be possible that the optimizer emits a warning/error when it relies on a DETECTED undefined behavior (here the number of unrolling does not match the number of iterations computed from the loop bounds)?