diff options
author | Richard Guenther <rguenther@suse.de> | 2010-07-10 09:40:36 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2010-07-10 10:40:36 +0100 |
commit | ccf134c74c7d1bc0511fdc648c9996164c44437d (patch) | |
tree | f4d0e0691bf6fc4afdab1aef5365f05b89f7a96e /gcc/tree-ssa-live.c | |
parent | bcee752ee514ebef752a6a8e4088b5669c8d3790 (diff) | |
download | gcc-ccf134c74c7d1bc0511fdc648c9996164c44437d.tar.gz |
re PR debug/44832 (-fcompare-debug failure for C++ i386.c)
2010-07-10 Richard Guenther <rguenther@suse.de>
Joern Rennecke <joern.rennecke@embecosm.com>
PR debug/44832
* tree-ssa-live.c (mark_all_vars_used_1): Set TREE_USED for
LABEL_DECL.
(remove_unused_scope_block_p): Don't drop TREE_USED LABEL_DECLs
unless they have DECL_IGNORED_P set.
Co-Authored-By: Joern Rennecke <joern.rennecke@embecosm.com>
From-SVN: r162035
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index d1f9e852b4a..883cca80989 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -383,6 +383,14 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data) } set_is_used (t); } + /* remove_unused_scope_block_p requires information about labels + which are not DECL_IGNORED_P to tell if they might be used in the IL. */ + if (TREE_CODE (t) == LABEL_DECL) + /* Although the TREE_USED values that the frontend uses would be + acceptable (albeit slightly over-conservative) for our purposes, + init_vars_expansion clears TREE_USED for LABEL_DECLs too, so we + must re-compute it here. */ + TREE_USED (t) = 1; if (IS_TYPE_OR_DECL_P (t)) *walk_subtrees = 0; @@ -462,6 +470,19 @@ remove_unused_scope_block_p (tree scope) else if ((ann = var_ann (*t)) != NULL && ann->used) unused = false; + else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t)) + /* For labels that are still used in the IL, the decision to + preserve them must not depend DEBUG_INFO_LEVEL, otherwise we + risk having different ordering in debug vs. non-debug builds + during inlining or versioning. + A label appearing here (we have already checked DECL_IGNORED_P) + should not be used in the IL unless it has been explicitly used + before, so we use TREE_USED as an approximation. */ + /* In principle, we should do the same here as for the debug case + below, however, when debugging, there might be additional nested + levels that keep an upper level with a label live, so we have to + force this block to be considered used, too. */ + unused = false; /* When we are not doing full debug info, we however can keep around only the used variables for cfgexpand's memory packing saving quite |