From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5DD0B3858D33; Tue, 8 Aug 2023 13:28:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DD0B3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691501280; bh=fgrgC9aQpsEc3x4oZLsJe8xCquCGRwKUyqu39QYQeqM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PWzs/NviSUZ5GmNbmcjuLOnPtwjPw18DTMfuvwZ+1aJQS8IG1tsDYDgYEoVrcM+6Y g33y1BkkiXkPoY48UojHjZJFcnfygNiSqy9QJUjP3QRbPfGP60Z7XiZEJuqbFyma26 Y6zPzwk7fGPkP2tV35cyAvieBlRzrQnJQC5RXO/Q= From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109684] compiling failure: complaining about a final subroutine of a type being not PURE (while it is indeed PURE) Date: Tue, 08 Aug 2023 13:27:58 +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: 13.1.1 X-Bugzilla-Keywords: 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: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109684 --- Comment #13 from Paul Thomas --- (In reply to Steve Kargl from comment #12) > On Mon, Aug 07, 2023 at 10:04:54PM +0000, kargl at gcc dot gnu.org wrote: > >=20 > > diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc > > index 3cd470ddcca..b0bb8bc1471 100644 > > --- a/gcc/fortran/resolve.cc > > +++ b/gcc/fortran/resolve.cc > > @@ -17966,7 +17966,9 @@ resolve_types (gfc_namespace *ns) > >=20 > > for (n =3D ns->contained; n; n =3D n->sibling) > > { > > - if (gfc_pure (ns->proc_name) && !gfc_pure (n->proc_name)) > > + if (gfc_pure (ns->proc_name) > > + && !gfc_pure (n->proc_name) > > + && !n->proc_name->attr.artificial) > > gfc_error ("Contained procedure %qs at %L of a PURE procedure m= ust " > > "also be PURE", n->proc_name->name, > > &n->proc_name->declared_at); > >=20 > > pault, dos the above look correct? > >=20 >=20 > This patch passes a regression test with no new regressions > on x86_64-*-*freebsd. Hi Steve, That will certainly fix the bug. An alternative crosses my mind, which is to check the pureness of the final routines as the wrapper is being built and = give the wrapper the pure attribute if they are all pure. Cheers Paul=