[Bug fortran/58916] Allocation of scalar with array source not rejected
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 9 11:13:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58916
--- Comment #2 from janus at gcc dot gnu.org ---
The following is sufficient to reject comment 1, but does not reject comment 0:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 205785)
+++ gcc/fortran/resolve.c (working copy)
@@ -6594,7 +6594,8 @@ conformable_arrays (gfc_expr *e1, gfc_expr *e2)
for (tail = e2->ref; tail && tail->next; tail = tail->next);
/* First compare rank. */
- if (tail && e1->rank != tail->u.ar.as->rank)
+ if ((tail && e1->rank != tail->u.ar.as->rank)
+ || (!tail && e1->rank != e2->rank))
{
gfc_error ("Source-expr at %L must be scalar or have the "
"same rank as the allocate-object at %L",
More information about the Gcc-bugs
mailing list