This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR42425
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Apr 2010 11:08:39 +0200 (CEST)
- Subject: [PATCH] Fix PR42425
This fixes another debug ICE with LTO.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2010-04-23 Richard Guenther <rguenther@suse.de>
PR lto/42425
* tree.c (free_lang_data_in_type): Do not free TYPE_CONTEXT
if emitting debug information and it is either a function
or a namespace decl.
* g++.dg/lto/20100423-2_0.C: New testcase.
Index: gcc/tree.c
===================================================================
*** gcc/tree.c (revision 158670)
--- gcc/tree.c (working copy)
*************** free_lang_data_in_type (tree type)
*** 4258,4264 ****
TYPE_LANG_SLOT_1 (type) = NULL_TREE;
}
! TYPE_CONTEXT (type) = NULL_TREE;
if (debug_info_level < DINFO_LEVEL_TERSE)
TYPE_STUB_DECL (type) = NULL_TREE;
}
--- 4258,4269 ----
TYPE_LANG_SLOT_1 (type) = NULL_TREE;
}
! 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 (debug_info_level < DINFO_LEVEL_TERSE)
TYPE_STUB_DECL (type) = NULL_TREE;
}
Index: gcc/testsuite/g++.dg/lto/20100423-2_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/20100423-2_0.C (revision 0)
--- gcc/testsuite/g++.dg/lto/20100423-2_0.C (revision 0)
***************
*** 0 ****
--- 1,14 ----
+ // { dg-lto-do assemble }
+ // { dg-lto-options {{-flto -g}} }
+
+ struct A
+ {
+ virtual ~A();
+ };
+
+ void foo()
+ {
+ struct B : A {};
+ B b;
+ }
+