]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/91641 (ICE in gfc_conv_is_contiguous_expr, at fortran/trans-intrinsic...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 1 Oct 2019 18:16:36 +0000 (18:16 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 1 Oct 2019 18:16:36 +0000 (18:16 +0000)
2019-10-01  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-10-01  Steven G. Kargl  <kargl@gcc.gnu.org>

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

From-SVN: r276419

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

index 97b32bb7e2543fc5e3d93041944f85fde045fd07..d2f47da78a72d898572994399f2d0f80e4ce4580 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-01  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-21  Paul Thomas  <pault@gcc.gnu.org>
 
        Backport from mainline
index 265fb1fda53e8198df6b2379355c22452e6e1525..27cb76dff718fe02a056020a3e8a123d21c23944 100644 (file)
@@ -6569,6 +6569,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;
 
@@ -6576,7 +6584,6 @@ gfc_check_is_contiguous (gfc_expr *array)
 }
 
 
-
 bool
 gfc_check_isatty (gfc_expr *unit)
 {
index 5cf8feb32a526a8bda65984068699288b2dc2e68..50db9f2125ee7c39bb16a0a1b4df52768a22cbcd 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-01  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91641
+       * gfortran.dg/pr91641.f90: New test.
+
 2019-10-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        Backport from mainline
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