From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10464 invoked by alias); 17 Oct 2011 17:37:23 -0000 Received: (qmail 10313 invoked by uid 22791); 17 Oct 2011 17:37:22 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Oct 2011 17:37:08 +0000 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50410] [4.6/4.7 Regression] ICE in record_reference Date: Mon, 17 Oct 2011 17:37: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: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.2 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: 2011-10/txt/msg01670.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50410 --- Comment #7 from kargl at gcc dot gnu.org 2011-10-17 17:36:33 UTC --- (In reply to comment #2) > The following produces a Segmentation fault in gfc_conv_structure (r178925) > > type t > integer g > end type > type(t) :: u=t(1) > data u%g /2/ > end The following patch removes the seqfault. If one adds 'print *, u%g' before end and compiles the resulting program, then one gets 1. This is acceptable, IMHO, because the code is invalid. Index: trans-expr.c =================================================================== --- trans-expr.c (revision 180099) +++ trans-expr.c (working copy) @@ -4747,7 +4747,7 @@ gfc_conv_structure (gfc_se * se, gfc_exp cm = expr->ts.u.derived->components; for (c = gfc_constructor_first (expr->value.constructor); - c; c = gfc_constructor_next (c), cm = cm->next) + c && cm; c = gfc_constructor_next (c), cm = cm->next) { /* Skip absent members in default initializers and allocatable components. Although the latter have a default initializer