[Bug fortran/68993] MERGE does not evaluate its arguments
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Mon Dec 21 16:09:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68993
--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, Dec 21, 2015 at 07:20:59AM +0000, Joost.VandeVondele at mat dot ethz.ch
wrote:
> I believe there was some confusion about the second testcase.
> The real question
> is if this is valid in all cases:
>
> MERGE(C_NULL_PTR, C_LOC(pc), .NOT.PRESENT(pc)))
>
> and I believe it is not, because all arguments might be evaluated. However, it
> is also OK not to evaluate all arguments for the reasons quoted.
>
Yes, there is confusion. I suspect the answer is the code is conforming
except when it isn't. For example, IABS(I) is conforming for all
values on a 2-complements system except for the value -huge(I)-1.
I would urge anyone trying to be clever to use clear syntax:
if (present(pc)) then
do stuff with pc
else
do stuff with c_null_ptr
end if
More information about the Gcc-bugs
mailing list