This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/77947] [7 Regression] ICE with -g and -O2 in strip_naming_typedef
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Oct 2016 10:33:10 +0000
- Subject: [Bug debug/77947] [7 Regression] ICE with -g and -O2 in strip_naming_typedef
- Auto-submitted: auto-generated
- References: <bug-77947-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77947
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
As we do not reclaim B::m_fn2::C::m_fn1 we IMHO shouldn't reclaim its
decl_function_context either. In that case we'd generate proper debug info
for B::m_fn2::C::m_fn1 which we end up using in the code later on through
devirt.
Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c (revision 241022)
+++ gcc/cgraphunit.c (working copy)
@@ -1126,6 +1126,13 @@ analyze_functions (bool first_time)
= cgraph_node::get_create (DECL_ABSTRACT_ORIGIN (decl));
origin_node->used_as_abstract_origin = true;
}
+ /* Preserve a functions function context node. It will
+ later be needed to output debug info. */
+ if (tree fn = decl_function_context (decl))
+ {
+ cgraph_node *origin_node = cgraph_node::get_create (fn);
+ enqueue_node (origin_node);
+ }
}
else
{
fixes this bug (and creates proper debug info).