From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4955 invoked by alias); 24 Jan 2015 22:25:10 -0000 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 Received: (qmail 4903 invoked by uid 48); 24 Jan 2015 22:25:05 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64757] [5 Regression] ICE in fold_convert_loc, at fold-const.c:2353 Date: Sat, 24 Jan 2015 22:25: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-Version: 5.0 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-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg02761.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64757 --- Comment #6 from janus at gcc dot gnu.org --- The following is sufficient to get rid of the ICE: Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 220084) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -6490,6 +6490,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_comp routine below is motivated by the alloc_scalar_allocatable_for_ assignment() routine, but with the realloc portions removed and different input. */ + if (cm->ts.type == BT_CLASS) + dest = gfc_class_data_get (dest); alloc_scalar_allocatable_for_subcomponent_assignment (&block, dest, cm, However, one needs to do more to get the correct run-time behavior: The _vptr needs to be set for the class component and one needs to use the correct size for the memory allocation.