diff options
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) |