This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Apr 2011 15:08:08 +0200
- Subject: [PATCH] Fix VTA ICE after fixup_noreturn_call (PR debug/48768)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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?
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