This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] Handling of .and. and .or. expressions
On 06/28/2018 06:22 PM, Steve Kargl wrote:
You continue to miss my point or conveniently ignore it.
You want to special case the forced evaluation of the
operands in two specific logical expressions; namely, .and.
and .or. If you want to force evaluation of operands, then
do it for all binary operators.
And - most interesting - that's how Fortran 77 formulated it (way before
PURE/IMPURE functions entered the language):
"6.6.1 Evaluation of Operands
It is not necessary for a processor to evaluate all of the operands of
an expression if the value of the expression can be determined
otherwise. This principle is most often applicable to logical
expressions, but it applies to all expressions. For example, in
evaluating the logical expression
X .GT. Y .OR. L(Z)
where X, Y, and Z are real, and L is a logical function, the function
reference L(Z) need not be evaluated if X is greater than Y. If a
statement contains a function reference in a part of an expression that
need not be evaluated, all entities that would have become defined in
the execution of that reference become undefined at the completion of
evaluation of the expression containing the function reference. In the
example above, evaluation of the expression causes Z to become undefined
if L defines its argument."
Kind regards,
--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news
- References:
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions
- Re: [patch, fortran] Handling of .and. and .or. expressions