From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C028F3858025; Tue, 19 Apr 2022 14:07:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C028F3858025 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 14:07:07 +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 14:07:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103662 --- Comment #15 from Jakub Jelinek --- Putting a breakpoint on new_alias_set, I see that RECORD_TYPE sq gets alias set 1 RECORD_TYPE s gets alias set 9 RECORD_TYPE t gets alias set 10 Those are type sq sequence integer :: i end type sq and type, bind(c) :: s integer (c_int) :: k end type s type t sequence integer :: k end type t in the testcase. The testcase stores through the sq type and reads through pointer to s and pointer to t type. As the alias sets are different, for t= he middle-end the testcase is invalid. Now, the question is what is the Fortran unlimited polymorphic semantics, if one can store through one type and read through a different type which just= has the same layout, or if it also has to use the same name etc., or if it is e= ven acceptable to store through say a type with a pair of integers and read thr= ough a type with double precision etc. GCC has types that can alias anything, so if the semantics is like that, unlimited polymorphic middle-end pointers perhaps should use that. Or the testcase is invalid and has to use type sq in foo as well. Or we ne= ed to ensure sq and s/t above have the same alias set.=