https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109684

--- Comment #14 from kargl at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #13)
> (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:
> > > 
> > > 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)
> > > 
> > >    for (n = ns->contained; n; n = 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);
> > > 
> > > pault, dos the above look correct?
> > > 
> > 
> > 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.
> 

Just saw that you attached a patch on 5/23/23 that it essentially the same as I
suggested.  I tried to simply set the final->attr.pure to 1, but this ran into
issues with the argument list having intent(inout) instead of just intent(in).

Reply via email to