Hello. This is patch attempt to target the discussion about sub-optimal generation of DO loops with abs(step) == 1. Originally generated code: D.3428 = (*array)[0]; D.3429 = (*array)[1]; i = D.3428; if (i <= D.3429) { while (1) { { logical(kind=4) D.3432; (*block)[(integer(kind=8)) i + -1] = (*block)[(integer(kind=8)) i + -1] + 10; L.1:; D.3432 = i == D.3429; i = i + 1; if (D.3432) goto L.2; } } } L.2:; Suggested: D.3428 = (*array)[0]; D.3429 = (*array)[1]; i = D.3428; while (1) { { logical(kind=4) D.3432; D.3432 = i > D.3429; if (D.3432) goto L.2; (*block)[(integer(kind=8)) i + -1] = (*block)[(integer(kind=8)) i + -1] + 10; L.1:; i = i + 1; } } L.2:; I would like to enable the behavior be default, patch does that starting from -O2. Apart from that, I've also added a new warning (candidate name: Wundefined-do-loop), which warns about cases that would lead to an infinite loop (because i > HUGE(i) == false): Warning: DO loop at (1) is infinite as it iterates to MIN_INT [-Wundefined-do-loop] /tmp/loop2.f90:15:19: do i = 0, huge(i) 1 Patch hasn't been properly tested, I've just tried to run all do_*.[fF]90 tests. Thoughts? Martin