aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2016-04-04 12:32:32 +0200
committerAndre Vehreschild <vehre@gcc.gnu.org>2016-04-04 12:32:32 +0200
commit7a85da896a9ceac338801d6ad0997ef7834660cb (patch)
treeafc2fedbeca840b624e3578d2279211a44b77cb5 /gcc/fortran/resolve.c
parentde517e644a374f7df40bf0b43254684dab717ac0 (diff)
downloadgcc-7a85da896a9ceac338801d6ad0997ef7834660cb.zip
gcc-7a85da896a9ceac338801d6ad0997ef7834660cb.tar.gz
gcc-7a85da896a9ceac338801d6ad0997ef7834660cb.tar.bz2
re PR fortran/67538 (ICE with invalid source allocation)
gcc/fortran/ChangeLog: 2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/67538 * resolve.c (resolve_allocate_expr): Emit error message when no array spec and no array valued source= expression is given in an F2008 allocate() for an array to allocate. gcc/testsuite/ChangeLog: 2016-04-04 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/67538 * gfortran.dg/allocate_with_source_19.f08: New test. From-SVN: r234714
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 55ab2ec..f5cd588 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -7217,7 +7217,15 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec)
if (!gfc_notify_std (GFC_STD_F2008, "Array specification required "
"in ALLOCATE statement at %L", &e->where))
goto failure;
- *array_alloc_wo_spec = true;
+ if (code->expr3->rank != 0)
+ *array_alloc_wo_spec = true;
+ else
+ {
+ gfc_error ("Array specification or array-valued SOURCE= "
+ "expression required in ALLOCATE statement at %L",
+ &e->where);
+ goto failure;
+ }
}
else
{