From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD7FF3858D35; Tue, 8 Mar 2022 19:25:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD7FF3858D35 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104844] New: CLASS actual to assumed-rank TYPE(*) wrongly passes declared instead of dynamic type Date: Tue, 08 Mar 2022 19:25:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Tue, 08 Mar 2022 19:25:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104844 Bug ID: 104844 Summary: CLASS actual to assumed-rank TYPE(*) wrongly passes declared instead of dynamic type Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- The following testcase shows that not the dynamic type but the declared typ= e is passed in the call. Or rather: It shows that decl->elem_len matches the declared type, I have n= ot checked the values. implicit none (type, external) type t integer, allocatable :: a(:,:,:), aa integer :: b(5), c end type t type t2 class(t), allocatable :: d(:,:), e end type t2 type, extends(t2) :: t2e integer :: q(7), z end type t2e type(t2) :: dummy class(t2), allocatable :: var allocate (t2e :: var) print *, sizeof(dummy), sizeof(var) ! prints 112 144 call sz_ar(var, var) contains subroutine sz_ar (a, b) type(*) :: a(..) class(*) :: b(..) print *, sizeof(a), sizeof(b) ! prints 112 144 - expected: 144 144 if (sizeof(a) /=3D sizeof(b)) error stop end end=