diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-06-11 11:05:40 +0100 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-07-14 12:56:20 +0100 |
commit | 81072bab8d1e48ee83d9711dcb559ea1e019b351 (patch) | |
tree | 8bdd1d3ff4a94be2ec4199a356ef5485d6c1c5b4 /gcc/fortran/expr.c | |
parent | 102502e32ea4e8a75d6b252ba319d09d735d9aa7 (diff) | |
download | gcc-81072bab8d1e48ee83d9711dcb559ea1e019b351.zip gcc-81072bab8d1e48ee83d9711dcb559ea1e019b351.tar.gz gcc-81072bab8d1e48ee83d9711dcb559ea1e019b351.tar.bz2 |
Fortran : ICE in gfc_check_pointer_assign PR95612
Output an error if the right hand value is a zero sized array or
does not have a symbol tree otherwise continue checking.
2020-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95612
* expr.c (gfc_check_pointer_assigb): Output an error if
rvalue is a zero sized array or output an error if rvalue
doesn't have a symbol tree.
2020-07-14 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95612
* gfortran.dg/pr95612.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5bef65d..6707ca5 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4271,7 +4271,20 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, gfc_symbol *sym; bool target; - gcc_assert (rvalue->symtree); + if (gfc_is_size_zero_array (rvalue)) + { + gfc_error ("Zero-sized array detected at %L where an entity with " + "the TARGET attribute is expected", &rvalue->where); + return false; + } + else if (!rvalue->symtree) + { + gfc_error ("Pointer assignment target in initialization expression " + "does not have the TARGET attribute at %L", + &rvalue->where); + return false; + } + sym = rvalue->symtree->n.sym; if (sym->ts.type == BT_CLASS && sym->attr.class_ok) |