From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8F0B43858404; Wed, 9 Aug 2023 15:37:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F0B43858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691595431; bh=S9lpIFU06tLLU1wNdT3WtyBJS0YWqLMHATKtQ/1PjzY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GwH/C2SlLkGZCUHokWCO07Ni52PsoSk03VO/FOubajCfPBtHwyVYozrCH/swZyHGf 0GLrHJHqHtkpkATOfv/aVilE9LGKdp1joX+31c6M9IiNf9H/MyN+3oIrut2uK7VD8L 0Rqtit3lqPQAyNeNUEmfpYziqPNytxKLVnXD1rlk= From: "sgk at troutmask dot apl.washington.edu" 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: Wed, 09 Aug 2023 15:37:11 +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: sgk at troutmask dot apl.washington.edu X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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 #21 from Steve Kargl = --- On Wed, Aug 09, 2023 at 10:08:45AM +0000, trnka at scm dot com wrote: >=20 > --- Comment #17 from Tom=C3=A1=C5=A1 Trnka --- > (In reply to kargl from comment #10) > > 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=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 must " > > "also be PURE", n->proc_name->name, > > &n->proc_name->declared_at); > >=20 > > pault, dos the above look correct? >=20 > On our codebase, this patch behaves just like the patch in comment #5, in= that > it also triggers the issue described in comment #7 (assert in a warning a= bout > non-recursive procedures getting called recursively). >=20 > Does either of you have any idea as to what that issue could be about? Or= is > isolating a testcase our only hope? I missed your comment #7 as simply grabbed the "slightly more simplified" attachment and started a bug hunt from there. Do either of the other testcase attachments exhibit the issue? The code in class.cc(generate_finalization_wrapper) sets=20 final->attr.pure =3D 0; final->attr.recursive =3D 1; final->attr.artificial =3D 1; for the artificial __final_* wrapper function. So, the routine should be recursive.=