diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-10-07 11:48:28 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-10-07 11:48:28 +0000 |
commit | 5abde510b7e2864c18144c658c4a5d26f8dc12d3 (patch) | |
tree | 2b203f2950f7fe7ca5f8344d3962aa131b60d08a /gcc/fortran/expr.c | |
parent | a4792d44311895bef287eb9632a1d4936ca8eafb (diff) | |
download | gcc-5abde510b7e2864c18144c658c4a5d26f8dc12d3.zip gcc-5abde510b7e2864c18144c658c4a5d26f8dc12d3.tar.gz gcc-5abde510b7e2864c18144c658c4a5d26f8dc12d3.tar.bz2 |
re PR fortran/49232 (Pointer assignment of stride to CONTIGUOUS pointer not diagnosed as invalid)
2017-10-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/49232
* expr.c (gfc_check_pointer_assign): Error
for non-contiguous rhs.
2017-10-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/49232
* gfortran.dg/contiguous_4.f90: New test.
From-SVN: r253509
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 8 |
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 |