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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
           Keywords|                            |accepts-invalid

--- Comment #4 from anlauf at gcc dot gnu.org ---
We might need to tighten the check of restricted expressions:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 663fe63dea6..6996e1e93d1 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -2849,6 +2852,21 @@ check_inquiry (gfc_expr *e, int not_restricted)
          && ap->expr->expr_type == EXPR_VARIABLE
          && asym->attr.dummy && asym->attr.optional)
        return MATCH_NO;
+
+      if (not_restricted == 0
+         && ap->expr->expr_type == EXPR_VARIABLE
+         && !(asym->attr.flavor == FL_PARAMETER)
+         && !asym->attr.dummy
+         && !asym->attr.in_common
+         && !asym->attr.use_assoc
+         && !asym->attr.host_assoc
+         && !asym->attr.implied_index
+         && (asym->attr.allocatable
+             || asym->attr.pointer
+             || (asym->as && asym->as->type == AS_DEFERRED)))
+       {
+         return MATCH_ERROR;
+       }
     }

   return MATCH_YES;


This needs to be refined further.

Reply via email to