From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25B34382FC98; Thu, 24 Nov 2022 17:07:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25B34382FC98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669309671; bh=nupJiuwuqvXu2KMOgv2fzcmh/3j9w7LOO9upyNrnbug=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i/QFiryhRKMS8Uo1GSG80iauI1QgQVrguGP1+UXKuHki8YQ75UPCRBRZCUvZEZwov ciXJskbu+/CMaIVfT2MrR0+DH9ERkRvgMF0wwgd1dtkK7MvcN++lgut+D1MEeJ3tAp qV7MixMlWpx6zXDz6dJjBwkkEH6p5hMVO1tRMTPM= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107819] ICE in gfc_check_argument_var_dependency, at fortran/dependency.cc:978 Date: Thu, 24 Nov 2022 17:07:50 +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: 13.0 X-Bugzilla-Keywords: ice-on-invalid-code, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D107819 --- Comment #5 from anlauf at gcc dot gnu.org --- (In reply to Mikael Morin from comment #4) > But is it required to generate a temporary? > As I understand it, the code is invalid, and (correctly) diagnosed, so th= ere > is nothing else to do. > It's invalid because of 15.5.2.13 Restrictions on entities associated with > dummy arguments: > (4) If the value of the entity or any subobject of it is affected through > the dummy argument, then at any time during the invocation and execution = of > the procedure, either before or after the definition, it shall be referen= ced > only through that dummy argument unless (...) Right. I was confused by two observations. First, NAG & Cray seem to generate temporaries, while Intel and NVidia don't and would agree with gfortran after the patch. Second, I stumbled over: ! 15.5.2.3 Argument association ! (4) A present dummy argument with the VALUE attribute becomes argument ! associated with a definable anonymous data object whose initial value is ! the value of the actual argument. So it boils down to what ELEMENTAL actually means in that context. F2018: 15.8.3 Elemental subroutine actual arguments ! In a reference to an elemental subroutine, if the actual arguments ! corresponding to INTENT(OUT) and INTENT(INOUT) dummy arguments are ! arrays, the values of the elements, if any, of the results are the same ! as would be obtained if the subroutine had been applied separately, in ! array element order, to corresponding elements of each array actual ! argument. So I read this that call s (a(n), a) is to be interpreted as do i =3D 1, size (a) call s (a(n(i)), a(i)) end do and this would actually be well-defined behavior... ;-)=