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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2020-06-04
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from kargl at gcc dot gnu.org ---
There may be a better (or more restrictive) test, but this cures the issues.

Index: gcc/fortran/intrinsic.c
===================================================================
--- gcc/fortran/intrinsic.c     (revision 280157)
+++ gcc/fortran/intrinsic.c     (working copy)
@@ -4428,6 +4428,19 @@ check_arglist (gfc_actual_arglist **ap, gfc_intrinsic_
          return false;
        }

+      /* F2018, p. 328: An argument to an intrinsic procedure other than
+        ASSOCIATED, NULL, or PRESENT shall be a data object.  A EXPR_NULL
+        is not a data object.  */
+      if (actual->expr->expr_type == EXPR_NULL
+         && !(strcmp(gfc_current_intrinsic, "associated") == 0
+               || strcmp(gfc_current_intrinsic, "null") == 0
+               || strcmp(gfc_current_intrinsic, "present") == 0))
+       {
+         gfc_error ("NULL() at %L cannot appear as an actual argument in %qs",
+                    &actual->expr->where, gfc_current_intrinsic);
+         return false;
+       }
+
       /* If the formal argument is INTENT([IN]OUT), check for definability. 
*/
       if (formal->intent == INTENT_INOUT || formal->intent == INTENT_OUT)
        {

Reply via email to