re PR fortran/83742 (ICE in gfc_is_simply_contiguous, at fortran/expr.c:5323)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 9 Jan 2018 19:49:25 +0000 (19:49 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 9 Jan 2018 19:49:25 +0000 (19:49 +0000)
2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/83742
* expr.c (gfc_is_simply_contiguous): Check for NULL pointer.

2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/83742
* gfortran.dg/contiguous_6.f90: New test.

From-SVN: r256391

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

index 32586c509f938949f8e690c2986cb68cd8fac543..e19ed61698b0ddd80a62829c2dbf75b8e7df40cf 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/83742
+       * expr.c (gfc_is_simply_contiguous): Check for NULL pointer.
+
 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        * match.c (gfc_match_allocate): Check for NULL pointer.
index 5be8da18b05dbb833da369df3cd6dc03fd28e9cb..45ccc184fc18a27d09fabebe8d978b2a2242fbb6 100644 (file)
@@ -5313,14 +5313,14 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element)
 
   sym = expr->symtree->n.sym;
   if (expr->ts.type != BT_CLASS
-       && ((part_ref
-               && !part_ref->u.c.component->attr.contiguous
-               && part_ref->u.c.component->attr.pointer)
-           || (!part_ref
-               && !sym->attr.contiguous
-               && (sym->attr.pointer
-                   || sym->as->type == AS_ASSUMED_RANK
-                   || sym->as->type == AS_ASSUMED_SHAPE))))
+      && ((part_ref
+          && !part_ref->u.c.component->attr.contiguous
+          && part_ref->u.c.component->attr.pointer)
+         || (!part_ref
+             && !sym->attr.contiguous
+             && (sym->attr.pointer
+                 || (sym->as && sym->as->type == AS_ASSUMED_RANK)
+                 || (sym->as && sym->as->type == AS_ASSUMED_SHAPE)))))
     return false;
 
   if (!ar || ar->type == AR_FULL)
index bbf9c760647acbd1e134bc37ec610ded04bd960b..6357b535b7f4ad11f4433abf33177db6b00c6ddd 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-09  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/83742
+       * gfortran.dg/contiguous_6.f90: New test.
+
 2018-01-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/83668
diff --git a/gcc/testsuite/gfortran.dg/contiguous_6.f90 b/gcc/testsuite/gfortran.dg/contiguous_6.f90
new file mode 100644 (file)
index 0000000..b17c7ed
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/83742
+! Contributed by Gerhard Steinmetz <gscfq at t-online dot de>
+program p
+   real, target :: a
+   real, pointer, contiguous :: b => a ! { dg-error "has the CONTIGUOUS attribute" }
+end