From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32306 invoked by alias); 3 Jan 2013 14:47:28 -0000 Received: (qmail 32196 invoked by uid 48); 3 Jan 2013 14:46:55 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55854] ICE on intent(out) dummy argument with unlimited polymorphic component Date: Thu, 03 Jan 2013 14:47: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-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus 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/msg00179.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55854 --- Comment #3 from Tobias Burnus 2013-01-03 14:46:54 UTC --- The problem seems to be the "gfc_class_null_initializer", where "ts" is unlimited polymorphic and "init_expr" is of type "__class__$tar_a" (and EXPR_NULL). The latter leads to the generation of __vtab_CLASS_0_ with the associated _copy function. Besides the wrong type, the generation _copy is triggered very late, namely in gfc_trans_deferred_vars-> gfc_trans_structure_assign. That's the reason for using the wrong scope and - hence - for the ICE. Patch: --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -414,7 +414,7 @@ gfc_class_null_initializer (gfc_typespec *ts, gfc_expr *init_expr) && ts->u.derived->components->ts.u.derived->attr.unlimited_polymorphic; if (is_unlimited_polymorphic && init_expr) - vtab = gfc_find_intrinsic_vtab (&(init_expr->ts)); + vtab = gfc_find_intrinsic_vtab (&ts->u.derived->components->ts); else vtab = gfc_find_derived_vtab (ts->u.derived);