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/55887] [OOP][F2008] ICE with CLASS and data-target pointer association in (default) initialization


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

--- Comment #3 from janus at gcc dot gnu.org 2013-01-26 21:21:38 UTC ---
This patch fixes the ICE in comment 0:


Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (revision 195486)
+++ gcc/fortran/trans-decl.c    (working copy)
@@ -1484,6 +1484,12 @@ gfc_get_symbol_decl (gfc_symbol * sym)
       && (gfc_option.coarray != GFC_FCOARRAY_LIB
       || !sym->attr.codimension || sym->attr.allocatable))
     {
+      bool pointer;
+      if (sym->ts.type == BT_CLASS)
+    pointer = CLASS_DATA (sym)->attr.class_pointer
+          || CLASS_DATA (sym)->attr.allocatable;
+      else
+    pointer = sym->attr.pointer || sym->attr.allocatable;
       /* Add static initializer. For procedures, it is only needed if
      SAVE is specified otherwise they need to be reinitialized
      every time the procedure is entered. The TREE_STATIC is
@@ -1493,8 +1499,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
                           sym->attr.dimension
                           || (sym->attr.codimension
                               && sym->attr.allocatable),
-                          sym->attr.pointer
-                          || sym->attr.allocatable,
+                          pointer,
                           sym->attr.proc_pointer);
     }


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