From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7D28A3858D3C; Fri, 2 Dec 2022 21:05:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D28A3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670015143; bh=LGr10yB7qtlxRA+ks4SerH21IBPUTaBJ8+wKpPCKANw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CvClX9+tt6iMBZyjI1nZ8f5FPOboRRfHyH4R4nEKPiG3QyDGvfUQuXwtp2yi5FPUv af/PYXJ/3xhfaBWzvAbE02Kex5zbUdoa8OR8j8ogaN2zoV1dc2p9rU7lerkG/0XbiT QLs2IWE2dFd4bg+r2BV95whETfuBJuXlB0gQ26xM= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107874] merge not using all its arguments Date: Fri, 02 Dec 2022 21:05:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107874 --- 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= =20 > recursive I/O because tstuff and fstuff each print something in the=20 > statement > y =3D 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=20 > 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.=