From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1D4053857C5F; Wed, 29 Jul 2020 02:25:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D4053857C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595989553; bh=vXiQj8gBeDyWlhC38GWXLlR4yatajiJrRHlLLDhWDT8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gum7KD4pZlKNqicBNilX5g+xyf3JCiKfmx9JPc+uRYcvbV0WSL92neJsHqaDe9IHj oRv/L0Q8TgeQeLiZjXqswvdOkp3S9rFpqOHIOV88149694jPHhwZ9TsxIxXpCzvjX+ u0V9SFZclUbEMnT4CLvysO3n0YIajgCUgdm61z74= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/96325] Unclassifiable statement with syntax similar to a type-bound procedure call is accepted Date: Wed, 29 Jul 2020 02:25:52 +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: 10.2.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Wed, 29 Jul 2020 02:25:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96325 --- Comment #10 from kargl at gcc dot gnu.org --- (In reply to jvdelisle from comment #9) > I regression tested the patch in comment 8 and see these failures. >=20 > FAIL: gfortran.dg/pr93423.f90 -O (test for excess errors) > FAIL: gfortran.dg/typebound_call_31.f90 -O (test for errors, line 14) > FAIL: gfortran.dg/typebound_call_31.f90 -O (test for excess errors) Thanks for testing. Does the patch that follows fix the regressions? gfortran treats components and type bound procedures separately. I've (hopefully) adapted the patch to whether foo is either. Index: gcc/fortran/primary.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/fortran/primary.c (revision 280157) +++ gcc/fortran/primary.c (working copy) @@ -2240,6 +2240,18 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag= ,=20 inquiry =3D is_inquiry_ref (name, &tmp); if (inquiry) sym =3D NULL; + else + { + component =3D gfc_find_component (sym, name, false, false, &t= mp); + tbp =3D gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus); + if (!component && !tbp) + { + gfc_error ("%qs at %C is neither a component nor a type " + "bound procedure of the derived " + "type %qs", name, sym->name); + return MATCH_ERROR; + } + } if (sep =3D=3D '%' && primary->ts.type !=3D BT_UNKNOWN) intrinsic =3D true;=