https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109684
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #10 from kargl at gcc dot gnu.org --- (In reply to Neil Carlson from comment #9) > Bug is still present in 13.2.0. class.cc(generate_finalization_wrapper) contains the following /* Set up the procedure symbol. */ name = xasprintf ("__final_%s", tname); gfc_get_symbol (name, sub_ns, &final); sub_ns->proc_name = final; final->attr.flavor = FL_PROCEDURE; final->attr.function = 1; final->attr.pure = 0; final->attr.recursive = 1; final->result = final; final->ts.type = BT_INTEGER; final->ts.kind = 4; final->attr.artificial = 1; Note final->attr.pure = 0 seems to contradict C1595 while constructing the wrapper. I'm not too familiar with this portion of gfortran's internals. Either the attribute should be set to 1 or the error message can be suppressed through inspection of final->attr.artificial. 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?