The attach patch has been committed as obvious. The
ChangeLog entry should provide sufficient detail.
2019-09-29 Steven G. Kargl <[email protected]>
PR fortran/91641
* check.c (gfc_check_is_contiguous): null() cannot be an actual
argument to is_contiguous().
2019-09-29 Steven G. Kargl <[email protected]>
PR fortran/91641
* gfortran.dg/pr91641.f90: New test.
--
Steve
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 275715)
+++ gcc/fortran/check.c (working copy)
@@ -7098,12 +7098,19 @@ gfc_check_ttynam_sub (gfc_expr *unit, gfc_expr *name)
bool
gfc_check_is_contiguous (gfc_expr *array)
{
+ if (array->expr_type == EXPR_NULL
+ && array->symtree->n.sym->attr.pointer == 1)
+ {
+ gfc_error ("Actual argument at %L of %qs intrinsic shall be an "
+ "associated pointer", &array->where, gfc_current_intrinsic);
+ return false;
+ }
+
if (!array_check (array, 0))
return false;
return true;
}
-
bool
Index: gcc/testsuite/gfortran.dg/pr91641.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr91641.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr91641.f90 (working copy)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/91641
+! Code conyributed by Gerhard Steinmetz
+program p
+ real, pointer :: z(:)
+ print *, is_contiguous (null(z)) ! { dg-error "shall be an associated" }
+end