From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AABF3858D37; Thu, 22 Jun 2023 16:45:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AABF3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687452341; bh=4VE3c7FGeaPljngSZZ8Hl46iN6pqYOFaUwFMgE+VDyM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QmtSEJzWoZh+9ZpKh4qJBb9w/4c3WL0VfAbJKryEmlNtGAyECWOvydGaXy7chcTYZ xMFgawKo1aLP6hjFFx6jqwQgcYx+q5ixvDM3As+FIqzgtSh2ytCp9597nJPWHreLuJ hhapJ/SCLY4nW688DMKJrl9XAdBGMUWZNW0oPjQA= From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49213] [OOP] gfortran rejects structure constructor expression Date: Thu, 22 Jun 2023 16:45:40 +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: 8.1.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: major X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc assigned_to attachments.created 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D49213 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Assignee|janus at gcc dot gnu.org |pault at gcc dot gn= u.org --- Comment #35 from Paul Thomas --- Created attachment 55383 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55383&action=3Dedit Fix for this PR Hello again Neil, I had a tedious job to do, which I alleviated by fixing this bug :-) Dejagnu-style testcase below. Now the earliest surviving bug is gfortran-20160129.f90 and there are 22/64 remaining failures (there might be fewer; my octave test harness doesn't co= pe with multiple sources yet). Regards Paul ! { dg-do run } ! ! Contributed by Neil Carlson ! program main character(2) :: c type :: S integer :: n end type type(S) :: Sobj type, extends(S) :: S2 integer :: m end type type(S2) :: S2obj type :: T class(S), allocatable :: x end type type(T) :: Tobj Sobj =3D S(1) Tobj =3D T(Sobj) S2obj =3D S2(1,2) Tobj =3D T(S2obj) ! Failed here select type (x =3D> Tobj%x) type is (S2) if ((x%n .ne. 1) .or. (x%m .ne. 2)) stop 1 class default stop 2 end select c =3D " " call pass_it (T(Sobj)) if (c .ne. "S ") stop 3 call pass_it (T(S2obj)) ! and here if (c .ne. "S2") stop 4 contains subroutine pass_it (foo) type(T), intent(in) :: foo select type (x =3D> foo%x) type is (S) c =3D "S " if (x%n .ne. 1) stop 5 type is (S2) c =3D "S2" if ((x%n .ne. 1) .or. (x%m .ne. 2)) stop 6 class default stop 7 end select end subroutine end program=