[Bug fortran/47745] [OOP] Segfault with CLASS(*) and derived type dummy arguments

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 15 12:06:00 GMT 2011


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

--- Comment #5 from janus at gcc dot gnu.org 2011-02-15 11:53:36 UTC ---
One can get rid of the ICE via these two hunks:


Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c    (revision 170169)
+++ gcc/fortran/interface.c    (working copy)
@@ -2924,7 +2924,11 @@ matching_typebound_op (gfc_expr** tb_base,
     gfc_try result;

     if (base->expr->ts.type == BT_CLASS)
-      derived = CLASS_DATA (base->expr)->ts.u.derived;
+      {
+        if (!gfc_expr_attr (base->expr).class_ok)
+          continue;
+        derived = CLASS_DATA (base->expr)->ts.u.derived;
+      }
     else
       derived = base->expr->ts.u.derived;

 Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c    (revision 170169)
+++ gcc/fortran/primary.c    (working copy)
@@ -2033,7 +2033,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *t
   sym = expr->symtree->n.sym;
   attr = sym->attr;

-  if (sym->ts.type == BT_CLASS)
+  if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
     {
       dimension = CLASS_DATA (sym)->attr.dimension;
       pointer = CLASS_DATA (sym)->attr.class_pointer;



More information about the Gcc-bugs mailing list