From: Richard Guenther <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768)
Date: Tue, 26 Apr 2011 15:15:00 -0000 [thread overview]
Message-ID: <BANLkTikTjypbkVFfxm-K=cnkCa9-pZ+Mwg@mail.gmail.com> (raw)
In-Reply-To: <20110426130808.GG17079@tyan-ft48-01.lab.bos.redhat.com>
On Tue, Apr 26, 2011 at 3:08 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> fixup_noreturn_call when removing LHS of a noreturn call does:
> /* We need to remove SSA name to avoid checking errors.
> All uses are dominated by the noreturn and thus will
> be removed afterwards.
> We proactively remove affected non-PHI statements to avoid
> fixup_cfg from trying to update them and crashing. */
> if (TREE_CODE (op) == SSA_NAME)
> {
> use_operand_p use_p;
> imm_use_iterator iter;
> gimple use_stmt;
> bitmap_iterator bi;
> unsigned int bb_index;
>
> bitmap blocks = BITMAP_ALLOC (NULL);
>
> FOR_EACH_IMM_USE_STMT (use_stmt, iter, op)
> {
> if (gimple_code (use_stmt) != GIMPLE_PHI)
> bitmap_set_bit (blocks, gimple_bb (use_stmt)->index);
> else
> FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
> SET_USE (use_p, error_mark_node);
> }
> which is fine because all the uses will be cleaned up RSN afterwards.
> Unfortunately, during the cleanup VTA triggers and tries to add DEBUG exprs,
> if there is a degenerate PHI which contains just error_mark_node set above
> unfortunately that results in DEBUG something => <<< error >>>, which isn't
> valid.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk/4.6?
Ok.
Thanks,
Richard.
> 2011-04-26 Jakub Jelinek <jakub@redhat.com>
>
> PR debug/48768
> * tree-ssa.c (insert_debug_temp_for_var_def): If degenerate_phi_result
> is error_mark_node, set value to NULL.
>
> * gcc.dg/pr48768.c: New test.
>
> --- gcc/tree-ssa.c.jj 2011-04-13 10:54:49.000000000 +0200
> +++ gcc/tree-ssa.c 2011-04-26 10:56:28.000000000 +0200
> @@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_st
> value = degenerate_phi_result (def_stmt);
> if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
> value = NULL;
> + /* error_mark_node is what fixup_noreturn_call changes PHI arguments
> + to. */
> + else if (value == error_mark_node)
> + value = NULL;
> }
> else if (is_gimple_assign (def_stmt))
> {
> --- gcc/testsuite/gcc.dg/pr48768.c.jj 2011-04-26 10:58:17.000000000 +0200
> +++ gcc/testsuite/gcc.dg/pr48768.c 2011-04-26 10:57:30.000000000 +0200
> @@ -0,0 +1,38 @@
> +/* PR debug/48768 */
> +/* { dg-do compile } */
> +/* { dg-options "-O -fcompare-debug" } */
> +
> +int a, b;
> +
> +int
> +bar (void)
> +{
> + int i, j = 1;
> + for (i = 0; i != 10; i++)
> + {
> + lab:
> + if (i)
> + {
> + int *k = &j;
> + }
> + else if (j)
> + goto lab;
> + }
> + return 1;
> +}
> +
> +inline int
> +foo (int x)
> +{
> + unsigned int c = x;
> + int d = x;
> + if (bar ())
> + for (; c; c++)
> + while (x >= 0)
> + if (foo (d) >= 0)
> + {
> + d = bar ();
> + a = b ? b : 1;
> + }
> + return 0;
> +}
>
> Jakub
>
prev parent reply other threads:[~2011-04-26 13:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 13:59 Jakub Jelinek
2011-04-26 15:15 ` Richard Guenther [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTikTjypbkVFfxm-K=cnkCa9-pZ+Mwg@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).