https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599
--- Comment #27 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- [Replying to myself now] > A front end pass (what else did you expect? :-) > > 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. I am, of course, open to suggestions about the text of the warning.