diff options
author | Harald Anlauf <anlauf@gmx.de> | 2020-06-11 15:48:56 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:12:16 -0300 |
commit | 671987d2790d12fcd998040454413e4424b638ed (patch) | |
tree | 8325fc8a120c4f72ce71f04ec649ed2691f12416 /gcc/fortran/expr.c | |
parent | 07fdbf4dbe97e80935c774357aa9eb9ba9d5c202 (diff) | |
download | gcc-671987d2790d12fcd998040454413e4424b638ed.zip gcc-671987d2790d12fcd998040454413e4424b638ed.tar.gz gcc-671987d2790d12fcd998040454413e4424b638ed.tar.bz2 |
PR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
The check for assigning a pointer that cannot be determined to be simply
contiguous at compile time to a contiguous pointer does not need to be
invoked if the lhs of the assignment is known to have conflicting attributes.
2020-06-11 Harald Anlauf <anlauf@gmx.de>
gcc/fortran/
PR fortran/95503
* expr.c (gfc_check_pointer_assign): Skip contiguity check of rhs
of pointer assignment if lhs cannot be simply contiguous.
gcc/testsuite/
PR fortran/95503
* gfortran.dg/pr95503.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 4 |
1 files changed, 3 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); |