This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors
- 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: Fri, 28 Dec 2012 17:49:41 +0000
- Subject: [Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors
- Auto-submitted: auto-generated
- References: <bug-55825-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55825
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-12-28
Ever Confirmed|0 |1
--- Comment #2 from janus at gcc dot gnu.org 2012-12-28 17:49:41 UTC ---
Draft patch:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 194743)
+++ gcc/fortran/resolve.c (working copy)
@@ -1089,7 +1089,10 @@ resolve_structure_cons (gfc_expr *expr, int init)
continue;
}
- rank = comp->as ? comp->as->rank : 0;
+ if (comp->ts.type == BT_CLASS)
+ rank = CLASS_DATA (comp)->as ? CLASS_DATA (comp)->as->rank : 0;
+ else
+ rank = comp->as ? comp->as->rank : 0;
if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank
&& (comp->attr.allocatable || cons->expr->rank))
{
This gets me past the first error in comment 1, but does not fix the second
one.