From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A6EC388F017; Mon, 12 Jul 2021 16:26:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A6EC388F017 From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/101199] program changes the value of a dummy argument Date: Mon, 12 Jul 2021 16:26:16 +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: 11.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: bug_status resolution see_also 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 16:26:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101199 Thomas Koenig changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D30373 --- Comment #7 from Thomas Koenig --- This is indeed a problem with aliasing and INTENT(OUT). When passing this to initoriginal_struct, specifying intent(out) is telling the compiler that this%var1 contains random garbage, in other words, that you could also write subroutine initoriginal_struct(this, var1) class(original_struct), intent(out) :: this real, intent(in) :: var1 call random_number(this%var1) print*, 'head of initoriginal_struct, the input argument var1 =3D '= , var1 this%var1 =3D var1 end subroutine initoriginal_struct This will then show up the aliasing problem because var1 is aliased to this%var1. gfortran currently does not detect this. There is a longstanding feature request about this, PR 30373. Resolving as invalid.=