From: Jakub Jelinek Date: Thu, 11 Feb 2016 09:08:03 +0000 (+0100) Subject: backport: re PR debug/66432 (libgomp.c/appendix-a/a.29.1.c -O2 -g: type mismatch... X-Git-Tag: releases/gcc-4.9.4~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec47d4052727c4628ce82ef27ea925c6b13c857a;p=thirdparty%2Fgcc.git backport: re PR debug/66432 (libgomp.c/appendix-a/a.29.1.c -O2 -g: type mismatch between an SSA_NAME and its symbol) Backported from mainline 2015-11-21 Jakub Jelinek PR debug/66432 * tree-inline.c (copy_debug_stmt): If gimple_debug_source_bind_get_value is DECL_ORIGIN of a PARM_DECL in decl_debug_args, don't call remap_gimple_op_r on it. * gcc.dg/debug/pr66432.c: New test. From-SVN: r233320 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f63667bcde57..7508126e52f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2016-02-11 Jakub Jelinek Backported from mainline + 2015-11-21 Jakub Jelinek + + PR debug/66432 + * tree-inline.c (copy_debug_stmt): If + gimple_debug_source_bind_get_value is DECL_ORIGIN of a PARM_DECL + in decl_debug_args, don't call remap_gimple_op_r on it. + 2015-11-19 Jakub Jelinek PR target/67770 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48a77ec19315..c5dd7b58f8c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2016-02-11 Jakub Jelinek Backported from mainline + 2015-11-21 Jakub Jelinek + + PR debug/66432 + * gcc.dg/debug/pr66432.c: New test. + 2015-11-19 Jakub Jelinek PR target/67770 diff --git a/gcc/testsuite/gcc.dg/debug/pr66432.c b/gcc/testsuite/gcc.dg/debug/pr66432.c new file mode 100644 index 000000000000..cf36799f3aaa --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr66432.c @@ -0,0 +1,19 @@ +/* PR debug/66432 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +extern void baz (const char *, const char *) __attribute__ ((__noreturn__)); + +void +foo (int x, int y[x][x]) +{ + if (x < 2) + baz ("", ""); +} + +void +bar (void) +{ + int z[2][2] = { { 1, 2 }, { 3, 4 } }; + foo (2, z); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 04d099f61f4a..e2048f416979 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2655,8 +2655,6 @@ copy_debug_stmt (gimple stmt, copy_body_data *id) else if (gimple_debug_source_bind_p (stmt)) { gimple_debug_source_bind_set_var (stmt, t); - walk_tree (gimple_debug_source_bind_get_value_ptr (stmt), - remap_gimple_op_r, &wi, NULL); /* When inlining and source bind refers to one of the optimized away parameters, change the source bind into normal debug bind referring to the corresponding DEBUG_EXPR_DECL that should have @@ -2680,7 +2678,10 @@ copy_debug_stmt (gimple stmt, copy_body_data *id) break; } } - } + } + if (gimple_debug_source_bind_p (stmt)) + walk_tree (gimple_debug_source_bind_get_value_ptr (stmt), + remap_gimple_op_r, &wi, NULL); } processing_debug_stmt = 0;