aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/expr.c4
-rw-r--r--gcc/testsuite/gfortran.dg/pr95503.f907
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index a9fa03a..8daa7bb 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4346,7 +4346,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue,
contiguous. Be lenient in the definition of what counts as
contiguous. */
- if (lhs_attr.contiguous && !gfc_is_simply_contiguous (rvalue, false, true))
+ if (lhs_attr.contiguous
+ && lhs_attr.dimension > 0
+ && !gfc_is_simply_contiguous (rvalue, false, true))
gfc_warning (OPT_Wextra, "Assignment to contiguous pointer from "
"non-contiguous target at %L", &rvalue->where);
diff --git a/gcc/testsuite/gfortran.dg/pr95503.f90 b/gcc/testsuite/gfortran.dg/pr95503.f90
new file mode 100644
index 0000000..4a202b4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95503.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/95503 - ICE in gfc_is_simply_contiguous
+
+program p
+ complex, target :: a
+ real, pointer, contiguous :: b => a%re ! { dg-error "not an array pointer" }
+end