https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107874

--- Comment #19 from anlauf at gcc dot gnu.org ---
(In reply to john.harper from comment #18)
> An interesting problem! But I thought my original test case did not have 
> recursive I/O because tstuff and fstuff each print something in the 
> statement
>     y = merge(tstuff(),fstuff(),x(i))
> but y itself is printed only in the next statement,
>     print *,y

John, your original testcase in comment#0 was fine.
I tried to extend it to check for constant as well as non-constant mask,
and as you see I made a mistake by trying to make it smaller.  Bad idea.

> Or does evaluating merge allow each of tstuff and fstuff to be evaluated
> at the same time? I was thinking of tstuff and fstuff being evaluated
> in succession but could there be systems in which they are evaluated 
> simultaneously?

I don't recall having seen a mentioning in the standard of the order of
evaluation of different function (or subroutine) arguments.  Do you?

(Of course, if side-effects happen during that evaluation, such as I/O,
unexpected things may happen.)

> If so, whether the program is valid Fortran depends on the
> kind of system on which it is being executed.

Well, even if the print in tstuff/fstuff were a problem, one could construct
other testcases with side-effects that might be conforming.

Reply via email to