[4.5, Fortran, Patch] PR 38432 - Add warning for loops which are never executed
Daniel Kraft
d@domob.eu
Sun Dec 7 14:58:00 GMT 2008
Hi Tobias,
Tobias Burnus wrote:
> 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.
My opinion is that we should go for always printing the warning, unless
-w is given of course. On the other hand, I'm not aware of many
warnings (that is, none except the non-polymorphic passed-object
warning) being printed without any -W flag, so maybe -Wsurprising is in
fact the better choice. But both is ok for me.
> Build and tested on x86-64-linux.
> OK for 4.5?
OK for 4.5, thanks for the patch!
Yours,
Daniel
--
Done: Arc-Bar-Cav-Rog-Sam-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran-Tou
More information about the Fortran
mailing list