From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A717389442B; Sun, 2 May 2021 17:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A717389442B From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99819] [9/10/11/12 Regression] ICE in gfc_defer_symbol_init, at fortran/trans-decl.c:841 Date: Sun, 02 May 2021 17:05:47 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 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 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: Sun, 02 May 2021 17:05:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99819 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gn= u.org --- Comment #2 from Paul Thomas --- Created attachment 50735 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50735&action=3Dedit Experimenta "fix" for the PR The problem lies in class.c(gfc_build_class_symbol). The attachment contains two different experiments to test the hypothesis th= at the array_spec for 'y' is applied to the _data field of the derived type, w= hich is then promoted to the main namespace. Subsequently, it is picked up in the declaration of 'z', which cause the problem. The first chunk, used by itself, turns the array_spec into a deferred array. The extent information is lost but the testcase now compiles and runs (incorrectly!). The second chunk, again by itself, puts the derived type representation in the function namespace. This now runs the testcase correc= tly and does the right thing. However, it can only encompass one such dummy. I'm onto it:-) Paul program p type t integer :: i end type class(t), allocatable :: dum1(:), dum2(:) allocate (t :: dum1(3), dum2(10)) dum2%i =3D [1,2,3,4,5,6,7,8,9,10] print *, f(dum1, dum2), g(dum1) contains function g(z) class(*) :: z(:) type(t) :: u(size(z)) g =3D 0 end function f(x, y) class(t) :: x(:) class(*) :: y(size(x)) print *, size(y) select type (y) type is (t) f =3D 1 if (any (y%i .ne. [1,2,3])) print *, size(y%i) class default f =3D 0 end select end end=