From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6273 invoked by alias); 26 Jan 2013 21:21:54 -0000 Received: (qmail 6221 invoked by uid 48); 26 Jan 2013 21:21:39 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55887] [OOP][F2008] ICE with CLASS and data-target pointer association in (default) initialization Date: Sat, 26 Jan 2013 21:21:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg02467.txt.bz2 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); }