re PR fortran/91641 (ICE in gfc_conv_is_contiguous_expr, at fortran/trans-intrinsic...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 29 Sep 2019 19:12:08 +0000 (19:12 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 29 Sep 2019 19:12:08 +0000 (19:12 +0000)
2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91641
* check.c (gfc_check_is_contiguous): null() cannot be an actual
argument to is_contiguous().

2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91641
* gfortran.dg/pr91641.f90: New test.

From-SVN: r276272

gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr91641.f90 [new file with mode: 0644]

index d4f39cc..694fc32 100644 (file)
@@ -1,5 +1,11 @@
 2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/91641
+       * check.c (gfc_check_is_contiguous): null() cannot be an actual
+       argument to is_contiguous().
+
+2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/91714
        * decl.c (gfc_match_decl_type_spec):  Issue errors for a few
        mangled types.
index a04f9fb..98203bc 100644 (file)
@@ -7098,6 +7098,14 @@ 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;
 
@@ -7105,7 +7113,6 @@ gfc_check_is_contiguous (gfc_expr *array)
 }
 
 
-
 bool
 gfc_check_isatty (gfc_expr *unit)
 {
index 052fd2e..43dc4ce 100644 (file)
@@ -1,5 +1,10 @@
 2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/91641
+       * gfortran.dg/pr91641.f90: New test.
+
+2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/91714
        * gfortran.dg/dec_type_print_3.f90: Update dg-error regex.
        * gfortran.dg/pr91714.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr91641.f90 b/gcc/testsuite/gfortran.dg/pr91641.f90
new file mode 100644 (file)
index 0000000..1970824
--- /dev/null
@@ -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