https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95503
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |7.4.1, 8.3.1 Last reconfirmed| |2020-06-03 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC| |anlauf at gcc dot gnu.org Known to fail| |10.1.1, 11.0, 9.3.1 --- Comment #1 from anlauf at gcc dot gnu.org --- The following patch fixes the ICE: diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index a9fa03ad153..8daa7bb8d06 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); Not regtested though. In some sense a 9/10/11 regression, although %re etc. did not exist in 8 and older.