[4.5, Fortran, Patch] PR 38432 - Add warning for loops which are never executed

Tobias Burnus burnus@net-b.de
Sun Dec 7 14:41:00 GMT 2008


the patch adds a warning for loops which have zero iterations, e.g.

do i = 1, 0
   ! never reached
end do

(/ i, i=1,2,-1 /)  ! Empty array

The question is whether the warning should be printed always (like
currently) or only with -W* (-Wsurprising)? For normal loops there are
nearly alway not intended; for array constructors they can be used on
purpose to construct zero-sized arrays; I don't think that happens often
with real-world code, but some (few) programs could have a lot of those.

Build and tested on x86-64-linux.
OK for 4.5?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: docheck_comp.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081207/b7d55d30/attachment.ksh>

More information about the Gcc-patches mailing list