From 116bc3a4d8ddc47c07bd9e619cd4f860d491069d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 18 May 2011 11:22:41 +0200 Subject: [PATCH] re PR tree-optimization/49000 (ICE: verify_ssa failed with -O2 -g) PR tree-optimization/49000 * tree-ssa.c (execute_update_addresses_taken): Call maybe_rewrite_mem_ref_base on debug stmt value. If it couldn't be rewritten and decl has been marked for renaming, reset the debug stmt. * gcc.dg/pr49000.c: New test. From-SVN: r173849 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr49000.c | 29 +++++++++++++++++++++++++++++ gcc/tree-ssa.c | 11 +++++++++++ 4 files changed, 53 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr49000.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4540ec42c89..f3e55e8592e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-05-18 Jakub Jelinek + + PR tree-optimization/49000 + * tree-ssa.c (execute_update_addresses_taken): Call + maybe_rewrite_mem_ref_base on debug stmt value. If it couldn't + be rewritten and decl has been marked for renaming, reset + the debug stmt. + 2011-05-17 Joseph Myers * config/i386/i386.c (ix86_valid_target_attribute_tree): Use diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 841c72d8d29..df63223a7d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-18 Jakub Jelinek + + PR tree-optimization/49000 + * gcc.dg/pr49000.c: New test. + 2011-05-17 Eric Botcazou * gnat.dg/invalid1.adb: New test. diff --git a/gcc/testsuite/gcc.dg/pr49000.c b/gcc/testsuite/gcc.dg/pr49000.c new file mode 100644 index 00000000000..32a1cdb35f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr49000.c @@ -0,0 +1,29 @@ +/* PR tree-optimization/49000 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +static +foo (int x, int y) +{ + return x * y; +} + +static int +bar (int *z) +{ + return *z; +} + +void +baz (void) +{ + int a = 42; + int *b = &a; + foo (bar (&a), 3); +} + +void +test (void) +{ + baz (); +} diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index f596fcd870c..ba5a20b6e47 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -2230,6 +2230,17 @@ execute_update_addresses_taken (void) } } + else if (gimple_debug_bind_p (stmt) + && gimple_debug_bind_has_value_p (stmt)) + { + tree *valuep = gimple_debug_bind_get_value_ptr (stmt); + tree decl; + maybe_rewrite_mem_ref_base (valuep); + decl = non_rewritable_mem_ref_base (*valuep); + if (decl && symbol_marked_for_renaming (decl)) + gimple_debug_bind_reset_value (stmt); + } + if (gimple_references_memory_p (stmt) || is_gimple_debug (stmt)) update_stmt (stmt); -- 2.30.2