From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2EA843858D33; Sun, 3 Dec 2023 10:40:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EA843858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701600046; bh=pfw0QOcpLsywainl7V3wi9v1fevJoh/rBISj2AjHikI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WX9s5Ftw0fU5Py3pzm4ILxjtnECTFWFh1G+YX+aTyGkvBV4cvTbhOKGWEgeDajQAT ze2DG7fpJc5992oUltPaa9cULC3qebmg10Vmg91dJJuBE7i62kJIvDZJwbCAHTjwcS kw7kB6tmZt8kbr4ZAPyJtO8Xxqy5JVxntFFyWmY4= From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/89645] No IMPLICIT type error with: ASSOCIATE( X => function() ) Date: Sun, 03 Dec 2023 10:40:44 +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: 9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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=3D89645 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gn= u.org --- Comment #4 from Paul Thomas --- Created attachment 56775 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56775&action=3Dedit Deadend fix for this PR I got as far as I could with this fix up method. The testcase below fails a= nd so I am going to set aside this approach and tackle what I should have done= in the first place: two step parsing of contained procedures. The patch contains a fix for class array function selectors that do not wor= k, even if the selector function is parsed first. I will make a new PR for this and will break out the patch for it and post it to the list. Paul module m implicit none type t integer :: i =3D 0 end type t integer :: i =3D 0 type(t), parameter :: test_array (2) =3D [t(42),t(84)], & test_scalar =3D t(99) end module m module class_selectors use m implicit none private public foo2 contains subroutine foo2() associate (var1 =3D> bar3()) if (any (var1%i .ne. test_array%i)) stop 8 if (var1(2)%i .ne. test_array(2)%i) stop 9 ! associate (var3 =3D> var1%i) ! This still fails ! print *, "yipee" ! end associate select type (x =3D> var1) type is (t) if (any (x%i .ne. test_array%i)) stop 10 if (x(1)%i .ne. test_array(1)%i) stop 11 class default stop 12 end select end associate select type (y =3D> bar3 ()) type is (t) print *, "yes, size of 'y' is ", size(y), y(1) class default print *, "no" end select end subroutine foo2 ! Since these functions are parsed after 'foo', the symbols were not availa= ble ! for the selectors and the fixup, tested here, was necessary. function bar3() result(res) class(t), allocatable :: res(:) allocate (res, source =3D test_array) end end module class_selectors use class_selectors call foo2 end=