From 0c5f6539adcff8eaad1a02002ac616f33c226b6e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 26 Apr 2011 15:35:21 +0200 Subject: [PATCH] re PR debug/48768 (ICE in get_expr_operands()) 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. From-SVN: r172968 --- gcc/ChangeLog | 4 ++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr48768.c | 38 ++++++++++++++++++++++++++++++++++ gcc/tree-ssa.c | 6 +++++- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr48768.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0bf1088b0bb..b528cf31eae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-04-26 Jakub Jelinek + PR debug/48768 + * tree-ssa.c (insert_debug_temp_for_var_def): If degenerate_phi_result + is error_mark_node, set value to NULL. + PR tree-optimization/48734 * tree-ssa-reassoc.c (eliminate_redundant_comparison): Give up if return value from maybe_fold_*_comparsions isn't something diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c07caacb2c1..3630dcef68b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-04-26 Jakub Jelinek + PR debug/48768 + * gcc.dg/pr48768.c: New test. + PR tree-optimization/48734 * gcc.c-torture/compile/pr48734.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr48768.c b/gcc/testsuite/gcc.dg/pr48768.c new file mode 100644 index 00000000000..7d0383e83bc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48768.c @@ -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; +} diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 4cd86c6781f..7f0a077b044 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1,5 +1,5 @@ /* Miscellaneous SSA utility functions. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) 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)) { -- 2.30.2