]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: Allow pure final procs contained in pure proc. [PR109684]
authorPaul Thomas <pault@gcc.gnu.org>
Wed, 9 Aug 2023 11:04:09 +0000 (12:04 +0100)
committerPaul Thomas <pault@gcc.gnu.org>
Wed, 9 Aug 2023 11:04:09 +0000 (12:04 +0100)
2023-08-09  Steve Kargl  <sgk@troutmask.apl.washington.edu>

gcc/fortran
PR fortran/109684
* resolve.cc (resolve_types): Exclude contained procedures with
the artificial attribute from test for pureness.

gcc/fortran/resolve.cc

index 3cd470ddccaf9a0d967fbdd2941cc9afa7d6fd46..e7c8d919bef0bad7610a694dd410055383c7d5f1 100644 (file)
@@ -17966,7 +17966,10 @@ resolve_types (gfc_namespace *ns)
 
   for (n = ns->contained; n; n = n->sibling)
     {
-      if (gfc_pure (ns->proc_name) && !gfc_pure (n->proc_name))
+      /* Exclude final wrappers with the test for the artificial attribute.  */
+      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);