aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-06-11 14:14:09 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-06-11 14:14:09 +0000
commite3b127e818dd591031a9cee6fbccd55c612cd643 (patch)
tree340e42ba07e8192d447a2f10a933a3b9b418dd7d /gcc/tree.c
parent5a20ffcb3afa4c44d0518d30010f002a32a8f7b2 (diff)
downloadgcc-e3b127e818dd591031a9cee6fbccd55c612cd643.zip
gcc-e3b127e818dd591031a9cee6fbccd55c612cd643.tar.gz
gcc-e3b127e818dd591031a9cee6fbccd55c612cd643.tar.bz2
re PR debug/53470 (ICE when linking with -g in splice_child_die, at dwarf2out.c:4264)
2012-06-11 Richard Guenther <rguenther@suse.de> PR middle-end/53470 * tree.c (free_lang_data_in_type): Do not clear TYPE_CONTEXT but replace it with the first non-BLOCK context. * g++.dg/lto/pr53470_0.C: New testcase. * gcc.dg/lto/pr53470_0.c: Likewise. From-SVN: r188387
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index e180340..d3c2a19 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4575,11 +4575,17 @@ free_lang_data_in_type (tree type)
free_lang_data_in_one_sizepos (&TYPE_SIZE (type));
free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type));
- if (debug_info_level < DINFO_LEVEL_TERSE
- || (TYPE_CONTEXT (type)
- && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL
- && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL))
- TYPE_CONTEXT (type) = NULL_TREE;
+ if (TYPE_CONTEXT (type)
+ && TREE_CODE (TYPE_CONTEXT (type)) == BLOCK)
+ {
+ tree ctx = TYPE_CONTEXT (type);
+ do
+ {
+ ctx = BLOCK_SUPERCONTEXT (ctx);
+ }
+ while (ctx && TREE_CODE (ctx) == BLOCK);
+ TYPE_CONTEXT (type) = ctx;
+ }
}