From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8358E385843B; Tue, 22 Feb 2022 22:01:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8358E385843B From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104651] [OOP] CLASS with assumed-size/assumed-rank array Date: Tue, 22 Feb 2022 22:01:37 +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: 12.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl 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: cc 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: Tue, 22 Feb 2022 22:01:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104651 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #0) > The following looks valid - but gfortran complains: >=20 > 7 | call bar(A) > | 1 > Error: Rank mismatch in argument =E2=80=98x=E2=80=99 at (1) (rank-1 and r= ank-2) >=20 > 8 | call bar2(B) > | 1 > Error: Rank mismatch in argument =E2=80=98y=E2=80=99 at (1) (rank-2 and r= ank-1) >=20 >=20 > Additionally, I had expected that the array is passed just to class->_dat= a, > but the dump shows that there is a full array descriptor, i.e. > class->_data.data for the dummy argument. >=20 >=20 > In trans-types.cc's gfc_get_derived_type, the code path taken is: >=20 > if (c->attr.pointer || c->attr.allocatable || c->attr.pdt_array) > ... > field_type =3D gfc_build_array_type (field_type, c->as, aki= nd, >=20 > and not: > else > field_type =3D gfc_get_nodesc_array_type (field_type, c->as, > PACKED_STATIC, > !c->attr.target); >=20 >=20 > implicit none (type, external) > type t > integer :: i > end type t > type(t) :: A(10,10), B(10) >=20 > call bar(A) > call bar2(B) > contains > subroutine bar(x) > class(t) :: x(*) > x(1)%i =3D x(2)%i > end > subroutine bar2(y) > class(t) :: y(5,10) > y(1,1)%i =3D y(2,2)%i > end > end Error look correct to me. Interfaces are resolved by type, kind, and rank; sometimes referred to TKR. Is there an exception for class?=