This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/58916] Allocation of scalar with array source not rejected
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Dec 2013 11:13:51 +0000
- Subject: [Bug fortran/58916] Allocation of scalar with array source not rejected
- Auto-submitted: auto-generated
- References: <bug-58916-4 at http dot gcc dot gnu dot org/bugzilla/>
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",