aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index bfbb19e..bc05db2 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3851,6 +3851,14 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
}
}
+ /* Error for assignments of contiguous pointers to targets which is not
+ contiguous. Be lenient in the definition of what counts as
+ congiguous. */
+
+ if (lhs_attr.contiguous && !gfc_is_simply_contiguous (rvalue, false, true))
+ gfc_error ("Assignment to contiguous pointer from non-contiguous "
+ "target at %L", &rvalue->where);
+
/* Warn if it is the LHS pointer may lives longer than the RHS target. */
if (warn_target_lifetime
&& rvalue->expr_type == EXPR_VARIABLE