http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52275
Bug #: 52275 Summary: The polyhedron test air.f90 is miscompiled with '-O2 -floop-flatten' after revision 184265 Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: domi...@lps.ens.fr CC: bur...@gcc.gnu.org, gros...@gcc.gnu.org, rgue...@gcc.gnu.org Host: x86_64-apple-darwin10 Target: x86_64-apple-darwin10 Build: x86_64-apple-darwin10 Revision 184265 fixes the ICE I saw on the 2005 polyhedron test air.f90. However as reported in comment #9 of pr50561, the test is miscompiled with '-O2 -floop-flatten' and higher optimization: ITERATION# TIME FINAL MASS RESIDUAL 10 0.000048597138 0.01000000 3.390685 23 0.000104076310 0.01000000 3.149714 37 0.000153111889 0.01000000 3.155547 53 0.000203760449 0.01000000 3.121681 70 0.000253653805 0.01000000 3.304361 90 0.000307361190 0.01000000 NaN 91 100.000307361190 0.01000000 NaN deltat, final t, iterations 100.00000000000000 100.00030736119007 91 10 3.3906853070974479 23 3.1497139386725364 37 3.1555468854046320 53 3.1216810612141770 70 3.3043611633047654 90 NaN 91 NaN or with -Ofast ITERATION# TIME FINAL MASS RESIDUAL a zero delta time was detected 0.29999999999999999 0.0000000000000000 deltat, final t, iterations 9.4702850481575148E-006 NaN 2 These miscompilations disappear if I add -fcheck=bound or -fwhole-program, but not if I add -flto. Note also that the test pass on powerpc-apple-darwin9. AFAICT the air.f90 is the only test in the suite having loops candidate for loop reversal or loop flattening, e.g., @@ -880,13 +880,13 @@ DO iy = 1 , NDY maxy = maxy + NPY(iy) + 1 dtd = 100.0 - DO i = minx , maxx - DO j = miny , maxy + DO j = miny , maxy + DO i = minx , maxx IF ( dtt(i,j).LE.dtd ) dtd = dtt(i,j) ENDDO ENDDO - DO i = minx , maxx - DO j = miny , maxy + DO j = miny , maxy + DO i = minx , maxx dtt(i,j) = dtd ENDDO ENDDO So far graphite has been unable to perform this optimization and the modified test is also miscompiled.