From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D643A3858C83; Tue, 19 Apr 2022 16:51:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D643A3858C83 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103662] [12 Regression] TBAA problem in Fortran FE triggering in gfortran.dg/unlimited_polymorphic_3.f03 Date: Tue, 19 Apr 2022 16:51:21 +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: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Tue, 19 Apr 2022 16:51:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103662 --- Comment #18 from Jakub Jelinek --- ! { dg-do run } ! ! Check that pointer assignments allowed by F2003:C717 ! work and check null initialization of CLASS(*) pointers. ! ! Contributed by Tobias Burnus ! program main interface subroutine foo(z) class(*), pointer, intent(in) :: z end subroutine foo end interface type sq sequence integer :: i end type sq type(sq), target :: x class(*), pointer :: y, z x%i =3D 42 y =3D> x z =3D> y ! unlimited =3D> unlimited allowed call foo (z) call bar contains subroutine bar type t end type t type(t), pointer :: x class(*), pointer :: ptr1 =3D> null() ! pointer initialization if (same_type_as (ptr1, x) .neqv. .FALSE.) STOP 1 end subroutine bar end program main subroutine foo(tgt) class(*), pointer, intent(in) :: tgt type sq sequence integer :: i end type sq type(sq), pointer :: ptr ptr =3D> tgt ! sequence type =3D> unlimited allowed if (ptr%i .ne. 42) STOP 2 end subroutine foo works with your patch and doesn't without it. But, if I change sq in foo to s, it doesn't work anymore. Though, seems ev= en type name and all member names are important, so I think we should just change the testcase to the above and perhaps add another one with bind(c) derived type instead of the sequence one.=