From df5deb18f15b3fad7e8cd7e1af71c9c52fb1cd7a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 17 Mar 2009 18:53:01 +0100 Subject: [PATCH] re PR debug/39474 (DW_AT_location missing for unused variables even at -O0) PR debug/39474 * tree-ssa-live.c (remove_unused_locals): Don't remove local unused non-artificial variables when not optimizing. From-SVN: r144914 --- gcc/ChangeLog | 4 ++++ gcc/tree-ssa-live.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fae65dbabcb..8e5fa32928d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ * dwarf2out.c (dwarf2out_imported_module_or_decl_1): Allow non-NAMESPACE_DECL IMPORTED_DECL_ASSOCIATED_DECL. + PR debug/39474 + * tree-ssa-live.c (remove_unused_locals): Don't remove local + unused non-artificial variables when not optimizing. + PR debug/39471 * dwarf2out.c (dwarf2out_imported_module_or_decl_1): Emit DW_TAG_imported_module even if decl is IMPORTED_DECL with diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 28a829caedf..5731964e457 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -740,7 +740,8 @@ remove_unused_locals (void) if (TREE_CODE (var) != FUNCTION_DECL && (!(ann = var_ann (var)) - || !ann->used)) + || !ann->used) + && (optimize || DECL_ARTIFICIAL (var))) { if (is_global_var (var)) { @@ -781,8 +782,7 @@ remove_unused_locals (void) if (TREE_CODE (var) == VAR_DECL && is_global_var (var) - && bitmap_bit_p (global_unused_vars, DECL_UID (var)) - && (optimize || DECL_ARTIFICIAL (var))) + && bitmap_bit_p (global_unused_vars, DECL_UID (var))) *cell = TREE_CHAIN (*cell); else cell = &TREE_CHAIN (*cell);