public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104844] New: CLASS actual to assumed-rank TYPE(*) wrongly passes declared instead of dynamic type
@ 2022-03-08 19:25 burnus at gcc dot gnu.org
2022-03-08 20:08 ` [Bug fortran/104844] " burnus at gcc dot gnu.org
2022-03-09 9:40 ` burnus at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-03-08 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104844
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 type is
passed in the call.
Or rather: It shows that decl->elem_len matches the declared type, I have not
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) /= sizeof(b)) error stop
end
end
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-09 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 19:25 [Bug fortran/104844] New: CLASS actual to assumed-rank TYPE(*) wrongly passes declared instead of dynamic type burnus at gcc dot gnu.org
2022-03-08 20:08 ` [Bug fortran/104844] " burnus at gcc dot gnu.org
2022-03-09 9:40 ` burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).