This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55887] [OOP][F2008] ICE with CLASS and data-target pointer association in (default) initialization
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 26 Jan 2013 21:21:38 +0000
- Subject: [Bug fortran/55887] [OOP][F2008] ICE with CLASS and data-target pointer association in (default) initialization
- Auto-submitted: auto-generated
- References: <bug-55887-4@http.gcc.gnu.org/bugzilla/>
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);
}