http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53957
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |fortran --- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-18 12:09:23 UTC --- The issue seems to be that the frontend uses two induction variables, one signed and one unsigned, for DO i = 1 , 1 + NINT(2.0D0*PI*trns/dphit) , & & NINT(ainc/(dphit*(180.0D0/PI))) ... END DO <bb 78>: # i_5 = PHI <[mp_prop_design.f90 : 697:0] 1(77), [mp_prop_design.f90 : 696:0] i_621(79)> # countm1.38_32 = PHI <[mp_prop_design.f90 : 696:0] countm1.38_466(77), [mp_prop_design.f90 : 696:0] countm1.38_622(79)> # prephitmp.386_3285 = PHI <pretmp.385_3284(77), D.2618_614(79)> # prephitmp.386_3287 = PHI <pretmp.385_3286(77), D.2620_620(79)> ... [mp_prop_design.f90 : 696:0] i_621 = i_5 + pretmp.378_3242; [mp_prop_design.f90 : 696:0] # DEBUG i => i_621 [mp_prop_design.f90 : 696:0] if (countm1.38_32 == 0) goto <bb 80>; else goto <bb 79>; <bb 79>: [mp_prop_design.f90 : 696:0] countm1.38_622 = countm1.38_32 + 4294967295; [mp_prop_design.f90 : 696 : 0] goto <bb 78>; and the "decrement" of countm1 happens in the loop latch block. It would be better to have this similar to other loops I see, bool flag = end-value == i; i = i + 1; if (flag) goto loop_exit;