From: Richard Biener Date: Wed, 14 Jan 2015 11:06:18 +0000 (+0000) Subject: re PR middle-end/64415 (ICE: verify_ssa failed / segmentation fault with LTO) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=683750ce0915e3703cf50d21c3150ed947b57617;p=gcc.git re PR middle-end/64415 (ICE: verify_ssa failed / segmentation fault with LTO) 2015-01-14 Richard Biener PR lto/64415 * tree-inline.c (insert_debug_decl_map): Check destination function MAY_HAVE_DEBUG_STMTS. (insert_init_debug_bind): Likewise. (insert_init_stmt): Remove redundant check. (remap_gimple_stmt): Drop debug stmts if the destination function has var-tracking assignments disabled. * gcc.dg/lto/pr64415_0.c: New testcase. * gcc.dg/lto/pr64415_1.c: Likewise. From-SVN: r219588 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d4c8ab640e..c852337d889 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-01-14 Richard Biener + + PR lto/64415 + * tree-inline.c (insert_debug_decl_map): Check destination + function MAY_HAVE_DEBUG_STMTS. + (insert_init_debug_bind): Likewise. + (insert_init_stmt): Remove redundant check. + (remap_gimple_stmt): Drop debug stmts if the destination + function has var-tracking assignments disabled. + 2015-01-14 Martin Liska * ipa-icf-gimple.c (func_checker::compare_operand): Add support for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efb7c378b95..e2929d3d42f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-01-14 Richard Biener + + PR lto/64415 + * gcc.dg/lto/pr64415_0.c: New testcase. + * gcc.dg/lto/pr64415_1.c: Likewise. + 2015-01-14 Martin Liska * gcc.dg/ipa/pr64307.c: New test. diff --git a/gcc/testsuite/gcc.dg/lto/pr64415_0.c b/gcc/testsuite/gcc.dg/lto/pr64415_0.c new file mode 100644 index 00000000000..fdf9d82550f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64415_0.c @@ -0,0 +1,13 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target fpic } */ +/* { dg-lto-options { { -O -flto -fpic } } } */ +/* { dg-extra-ld-options { -shared } } */ + +extern void bar(char *, int); + +extern char *baz; + +void foo() +{ + bar(baz, 0); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64415_1.c b/gcc/testsuite/gcc.dg/lto/pr64415_1.c new file mode 100644 index 00000000000..b98dfbd7935 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64415_1.c @@ -0,0 +1,17 @@ +/* { dg-options "-g" } */ + +extern int n; + +void bar(char *, int); + +inline void bar(char *s, int i) +{ + char *p = s; + +#ifdef V1 + if (i) +#else + if (n) +#endif + *s = 0; +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 4a47fd2842e..8fe92e4eb44 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -192,7 +192,7 @@ insert_debug_decl_map (copy_body_data *id, tree key, tree value) if (!gimple_in_ssa_p (id->src_cfun)) return; - if (!MAY_HAVE_DEBUG_STMTS) + if (!opt_for_fn (id->dst_fn, flag_var_tracking_assignments)) return; if (!target_for_debug_bind (key)) @@ -1348,6 +1348,10 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id) bool skip_first = false; gimple_seq stmts = NULL; + if (is_gimple_debug (stmt) + && !opt_for_fn (id->dst_fn, flag_var_tracking_assignments)) + return stmts; + /* Begin by recognizing trees that we'll completely rewrite for the inlining context. Our output for these trees is completely different from out input (e.g. RETURN_EXPR is deleted, and morphs @@ -3007,7 +3011,7 @@ insert_init_debug_bind (copy_body_data *id, if (!gimple_in_ssa_p (id->src_cfun)) return NULL; - if (!MAY_HAVE_DEBUG_STMTS) + if (!opt_for_fn (id->dst_fn, flag_var_tracking_assignments)) return NULL; tracked_var = target_for_debug_bind (var); @@ -3063,7 +3067,7 @@ insert_init_stmt (copy_body_data *id, basic_block bb, gimple init_stmt) gsi_insert_after (&si, init_stmt, GSI_NEW_STMT); gimple_regimplify_operands (init_stmt, &si); - if (!is_gimple_debug (init_stmt) && MAY_HAVE_DEBUG_STMTS) + if (!is_gimple_debug (init_stmt)) { tree def = gimple_assign_lhs (init_stmt); insert_init_debug_bind (id, bb, def, def, init_stmt);