--- Comment #29 from janus at gcc dot gnu.org ---
(In reply to Thomas Koenig from comment #27)
> > If an impure function is found (recursively) in the operands of an .AND.
> > expression, issue a
> > gfc_warning(OPT_Wsurprising, "Impure function %qs at %L may not be
> > evaluated", ...)
> > So,
> > if (flag .and. f(x) > 0.)
> > would also be warned about.
> I think I will start working on that warning; this should lead to
> users being made aware of a potential problem in their code.
That's not my favorite way of fixing it, but it's certainly an improvement upon
the current state of things, so I'm fine with it.
The warning text basically sounds good to me, although you could possibly
replace 'may' by 'might'. I'm not a native speaker, but I think that is clearer
and sounds less like "... is not allowed to be evaluated".
In addition to .and., a treatment of .or. is needed as well.