From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16037 invoked by alias); 11 Jan 2013 16:53:43 -0000 Received: (qmail 15906 invoked by uid 48); 11 Jan 2013 16:53:10 -0000 From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/55920] [4.8 Regression] ICE in expand_debug_locations, at cfgexpand.c:3753 Date: Fri, 11 Jan 2013 16:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: CC 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/msg01044.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55920 Martin Jambor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jamborm at gcc dot gnu.org --- Comment #3 from Martin Jambor 2013-01-11 16:53:08 UTC --- As far as the ICE is concerned, I think that if we want to fix it by reverting patches, we need to revert both the patch for PR 55579 and PR 54971 (which introduced the generation of the debug statement in question). Alternatively, we can punt and put NULL on the right side of the debug statement when types do not match. I looked at all places where SRA generates them and only in sra_modify_assign we can have this problem. Yes, in 4.9 we can even create a well-typed MEM_REF. Meanwhile, the minimal patch (that I am about to bootstrap and test) would be: 2013-01-11 Martin Jambor PR tree-optimization/55920 * tree-sra.c (sra_modify_assign): Put NULL RHS into debug statement if it would have incompatible types. Index: src/gcc/tree-sra.c =================================================================== --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -3108,8 +3108,15 @@ sra_modify_assign (gimple *stmt, gimple_ if (lacc && lacc->grp_to_be_debug_replaced) { - gimple ds = gimple_build_debug_bind (get_access_replacement (lacc), - unshare_expr (rhs), *stmt); + tree dbg_rhs; + gimple ds; + + if (useless_type_conversion_p (lacc->type, TREE_TYPE (rhs))) + dbg_rhs = unshare_expr (rhs); + else + dbg_rhs = NULL_TREE; + ds = gimple_build_debug_bind (get_access_replacement (lacc), dbg_rhs, + *stmt); gsi_insert_before (gsi, ds, GSI_SAME_STMT); }