From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0748A3857C65; Fri, 25 Jun 2021 05:59:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0748A3857C65 From: "ygalklein at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/101199] program changes the value of a dummy argument Date: Fri, 25 Jun 2021 05:59:51 +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: ygalklein at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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 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: Fri, 25 Jun 2021 05:59:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101199 --- Comment #2 from ygal klein --- The problem also persists in an example code that is with no extended type: ```fortran module mod_original_struct implicit none private public :: original_struct type original_struct private real, PUBLIC :: var1 contains private procedure, public :: init=3D>initoriginal_struct, advance end type original_struct contains subroutine advance(this) class(original_struct), intent(inout) :: this print*, 'head of advance, this%var1 =3D ', this%var1 call this%init(var1=3Dthis%var1) end subroutine advance subroutine initoriginal_struct(this, var1) class(original_struct), intent(out) :: this real, intent(in) :: var1 print*, 'head of initoriginal_struct, the input argument var1 =3D '= , var1 this%var1 =3D var1 end subroutine initoriginal_struct end module mod_original_struct program example use mod_original_struct, only: original_struct implicit none type(original_struct) :: struct1 call struct1%init(var1=3D10.) print*, 'bf advance, struct1%var1 =3D ', struct1%var1 call struct1%advance() end program example ``` The gfortran wrong output is: head of initoriginal_struct, the input argument var1 =3D 10.00000000000= 0000=20=20=20 bf advance, struct1%var1 =3D 10.000000000000000=20=20=20=20=20 head of advance, this%var1 =3D 10.000000000000000=20=20=20=20=20 head of initoriginal_struct, the input argument var1 =3D 0.000000000000= 0000=20 using intel 2020u4 provides the right output.=