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

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 28 19:24:00 GMT 2012


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

--- Comment #3 from janus at gcc dot gnu.org 2012-12-28 19:23:38 UTC ---
The second error is fixed by the following:

Index: gcc/fortran/intrinsic.c
===================================================================
--- gcc/fortran/intrinsic.c    (revision 194743)
+++ gcc/fortran/intrinsic.c    (working copy)
@@ -4287,8 +4287,9 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespe
   if (expr->ts.type == BT_UNKNOWN)
     goto bad;

-  if (expr->ts.type == BT_DERIVED && ts->type == BT_DERIVED
-      && gfc_compare_types (&expr->ts, ts))
+  if (expr->ts.type == BT_DERIVED
+      && (ts->type == BT_DERIVED || ts->type == BT_CLASS) 
+      && gfc_compare_types (ts, &expr->ts))
     return SUCCESS;

   sym = find_conv (&expr->ts, ts);



More information about the Gcc-bugs mailing list