http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54932
--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-01 13:59:11 UTC --- (In reply to comment #11) > > > Thus, I close the bug as INVALID. > > ... in wich case could you, please, update the testcase to be valid and > > remove > > the XFAIL I introduced? > > We jump through some hoops in or DO loop code generation to execute > a loop until HUGE(i) in a way that somebody who did not read the > standard well might expect, but which is actually invalid. > > If we do not do this any more, then we can probably simplify our DO > loops considerably. This is probably too late for 4.8.0. The following patch takes advantage of the new option -fno-aggressive-loop-optimizations to remove the xfail (and the two XPASS at -O0 and -O1): --- /opt/gcc/_gcc_clean/gcc/testsuite/gfortran.dg/do_1.f90 2012-10-18 00:34:47.000000000 +0200 +++ /opt/gcc/work/gcc/testsuite/gfortran.dg/do_1.f90 2013-01-31 22:02:16.000000000 +0100 @@ -1,5 +1,5 @@ -! { dg-do run { xfail *-*-* } } -! XFAIL is tracked in PR 54932 +! { dg-do run } +! { dg-additional-options "-fno-aggressive-loop-optimizations" } ! Program to check corner cases for DO statements. program do_1 implicit none Tested on x86_64-apple-darwin10 and powerpc-apple-darwin9. > We should also warn about invalid code in the FE. One example is program test_real_do integer n integer x n=0 do x=0.0,10.0,0.1 n=n+1 end do print *, "N is ", n end program test_real_do which on x86_64-apple-darwin10 gives Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation. when executed. This is due to the division by zero in x = 0; countm1.0 = 10 / 0; while (1) { { unsigned int countm1t.1; n = n + 1; L.1:; x = NON_LVALUE_EXPR <x>; countm1t.1 = countm1.0; countm1.0 = countm1.0 + 4294967295; if (countm1t.1 == 0) goto L.2; } } L.2:; The FE should detect that the stride is zero and output an error. Note that on powerpc-apple-darwin9, the same test (with the same dump-tree-original) runs and outputs N is 1 !?-(