https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86893
Bug ID: 86893
Summary: implement F202x .andthen. / .orelse. operators
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: janus at gcc dot gnu.org
Target Milestone: ---
The .and. / .or. operators in the current F2018 standard do not make any
guarantees about whether any of the arguments is required to be evaluated, or
is required to be optimized out.
There are rumors that new "short-circuiting" operators might be part of an
upcoming F202x standard. Those could be named .andthen., .andelse., .orelse. or
similar. Alternatively one could use C-style operators (&& and ||).
The new operators would be guaranteed to do left-to-right short-circuiting,
i.e. the second operand will not be evaluated if the value of the first one
already determines the final result.
Consequently the old .and. / .or. operators would be guaranteed to *not* do
short-circuiting (or only in cases where it makes no difference).