This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix debug info related ICE when inlining back fnsplit function (PR debug/66432)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>,gcc-patches at gcc dot gnu dot org
- Date: Sat, 21 Nov 2015 07:31:39 +0100
- Subject: Re: [PATCH] Fix debug info related ICE when inlining back fnsplit function (PR debug/66432)
- Authentication-results: sourceware.org; auth=none
- References: <20151120201101 dot GN5675 at tucnak dot redhat dot com>
On November 20, 2015 9:11:01 PM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>This patch fixes ICE where a parameter mentioned in a debug source bind
>has its VLA type mistakenly remapped and that leads to inconsistent
>type
>between the PARM_DECL and SSA_NAMEs derived from it.
>
>The patch Tom posted for this can't work, because we assume that the
>s=> value as well as debug_decl_args decl in that case is DECL_ORIGIN
>of the PARM_DECL. But, in this case we are replacing the DECL_ORIGIN
>PARM_DECL immediately with a DEBUG_EXPR_DECL anyway, so there is no
>point remapping the var we don't own (it could be in a different
>function
>etc.).
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
>trunk/5.3?
OK.
Thanks,
Richard.
>2015-11-20 Jakub Jelinek <jakub@redhat.com>
>
> 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.
>
>--- gcc/tree-inline.c.jj 2015-11-14 19:36:03.000000000 +0100
>+++ gcc/tree-inline.c 2015-11-20 17:17:00.632082622 +0100
>@@ -2864,8 +2864,6 @@ copy_debug_stmt (gdebug *stmt, copy_body
> 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
>@@ -2889,7 +2887,10 @@ copy_debug_stmt (gdebug *stmt, copy_body
> 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;
>--- gcc/testsuite/gcc.dg/debug/pr66432.c.jj 2015-11-20
>17:40:44.589171083 +0100
>+++ gcc/testsuite/gcc.dg/debug/pr66432.c 2015-11-20 17:38:48.000000000
>+0100
>@@ -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);
>+}
>
> Jakub