------- Comment #4 from janus at gcc dot gnu dot org  2010-05-15 10:46 -------
Turns out that fixing this one is completely trivial, once you actually have a
look at it :)

The ALLOCATED intrinsic was just not adjusted to handle CLASS variables yet.
The patch is as simple as this:

Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c       (revision 159389)
+++ gcc/fortran/trans-intrinsic.c       (working copy)
@@ -4529,6 +4529,8 @@ gfc_conv_allocated (gfc_se *se, gfc_expr *expr)
     {
       /* Allocatable scalar.  */
       arg1se.want_pointer = 1;
+      if (arg1->expr->ts.type == BT_CLASS)
+       gfc_add_component_ref (arg1->expr, "$data");
       gfc_conv_expr (&arg1se, arg1->expr);
       tmp = arg1se.expr;
     }

Thanks for the bug report, Salvatore.


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-05-15 10:25:15         |2010-05-15 10:46:53
               date|                            |
            Summary|[OOP]  CLASS(foo),          |[OOP] ALLOCATABLE with
                   |ALLOCATABLE component bad   |polymorphic variables
                   |initialization              |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43969

Reply via email to