From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30D7C3857C4E; Wed, 10 Feb 2021 18:17:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30D7C3857C4E From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99065] New: ASSOCIATE function selector expression "no IMPLICIT type" failure Date: Wed, 10 Feb 2021 18:17:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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: Wed, 10 Feb 2021 18:17:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99065 Bug ID: 99065 Summary: ASSOCIATE function selector expression "no IMPLICIT type" failure Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: pault at gcc dot gnu.org Target Milestone: --- Created attachment 50164 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50164&action=3Dedit Testcase illustrating the failure This bug was detected in testing variations of the testcase in PR98897. The attached fails with: ../pr98897/foo1.f90:9:20: 9 | print *, var%i | 1 Error: Symbol =E2=80=98var=E2=80=99 at (1) has no IMPLICIT type If the contained procedures 'foo' and 'bar' are interchanged it compiles and produces the intended result. All component references suffer from this problem. Intrinsic types are fixe= d up by parse.c(gfc_fixup_sibling_symbols) but there is no simple way to do this= for derived type or class selectors. Certain operator expressions also suffer from this problem. It is caused by parsing and matching in gfortran being single pass. This me= ans that unless the specification of 'bar', in this case, has been obtained, the type of 'var' cannot be determined and primary.c(gfc_match_varspec) is boun= d to return MATCH_NO. I am looking at either two passes for contained procedures (specification blocks first, followed by code blocks) or a fixup in gfc_match_varspec that looks through the derived types for successful matches. Paul=