[Bug tree-optimization/66413] [6 Regression] ICE at -Os and above with -g enabled on x86_64-linux-gnu

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 8 14:05:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66413

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, so IPA-CP propagates a constant to fn4 but this function has its parameter
unused (but by debug stmts).  It looks like we have a tree sharing issue here,
as the location while initially stripped, gets substituted back in via

#0  expand_gimple_stmt_1 (stmt=<gimple_assign 0x7ffff6a1ff50>)
    at /space/rguenther/tramp3d/trunk/gcc/cfgexpand.c:3317
3315                if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P
(rhs))
3316                  SET_EXPR_LOCATION (rhs, gimple_location (stmt));

which is expansion of fn2.constprop (but the same address-expression is
used in fn4.constprop).  The following fixes it for me:

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c   (revision 224221)
+++ gcc/tree-inline.c   (working copy)
@@ -3027,7 +3027,7 @@ insert_init_debug_bind (copy_body_data *
        base_stmt = gsi_stmt (gsi);
     }

-  note = gimple_build_debug_bind (tracked_var, value, base_stmt);
+  note = gimple_build_debug_bind (tracked_var, unshare_expr (value),
base_stmt);

   if (bb)
     {

the issue is surely latent on the GCC 5 branch.



More information about the Gcc-bugs mailing list