This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/55825] [OOP] Bogus rank error with CLASS pointer assignment using structure constructors


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]