Commit 3eec359d by Jason Merrill Committed by Jason Merrill

PR c++/80831 - ICE with -fsyntax-only.

	* decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.

From-SVN: r249318
parent b126bff4
2017-06-16 Jason Merrill <jason@redhat.com> 2017-06-16 Jason Merrill <jason@redhat.com>
PR c++/80831 - ICE with -fsyntax-only.
* decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
PR c++/80639 - ICE with invalid PMF initialization. PR c++/80639 - ICE with invalid PMF initialization.
PR c++/80043 - ICE with -fpermissive PR c++/80043 - ICE with -fpermissive
* typeck.c (convert_for_assignment): Recurse when instantiate_type * typeck.c (convert_for_assignment): Recurse when instantiate_type
......
...@@ -4627,6 +4627,8 @@ c_parse_final_cleanups (void) ...@@ -4627,6 +4627,8 @@ c_parse_final_cleanups (void)
if (!DECL_SAVED_TREE (decl)) if (!DECL_SAVED_TREE (decl))
continue; continue;
cgraph_node *node = cgraph_node::get_create (decl);
/* We lie to the back end, pretending that some functions /* We lie to the back end, pretending that some functions
are not defined when they really are. This keeps these are not defined when they really are. This keeps these
functions from being put out unnecessarily. But, we must functions from being put out unnecessarily. But, we must
...@@ -4647,9 +4649,6 @@ c_parse_final_cleanups (void) ...@@ -4647,9 +4649,6 @@ c_parse_final_cleanups (void)
&& DECL_INITIAL (decl) && DECL_INITIAL (decl)
&& decl_needed_p (decl)) && decl_needed_p (decl))
{ {
struct cgraph_node *node, *next;
node = cgraph_node::get (decl);
if (node->cpp_implicit_alias) if (node->cpp_implicit_alias)
node = node->get_alias_target (); node = node->get_alias_target ();
...@@ -4659,7 +4658,8 @@ c_parse_final_cleanups (void) ...@@ -4659,7 +4658,8 @@ c_parse_final_cleanups (void)
group, we need to mark all symbols in the same comdat group group, we need to mark all symbols in the same comdat group
that way. */ that way. */
if (node->same_comdat_group) if (node->same_comdat_group)
for (next = dyn_cast<cgraph_node *> (node->same_comdat_group); for (cgraph_node *next
= dyn_cast<cgraph_node *> (node->same_comdat_group);
next != node; next != node;
next = dyn_cast<cgraph_node *> (next->same_comdat_group)) next = dyn_cast<cgraph_node *> (next->same_comdat_group))
next->call_for_symbol_thunks_and_aliases (clear_decl_external, next->call_for_symbol_thunks_and_aliases (clear_decl_external,
...@@ -4673,7 +4673,7 @@ c_parse_final_cleanups (void) ...@@ -4673,7 +4673,7 @@ c_parse_final_cleanups (void)
if (!DECL_EXTERNAL (decl) if (!DECL_EXTERNAL (decl)
&& decl_needed_p (decl) && decl_needed_p (decl)
&& !TREE_ASM_WRITTEN (decl) && !TREE_ASM_WRITTEN (decl)
&& !cgraph_node::get (decl)->definition) && !node->definition)
{ {
/* We will output the function; no longer consider it in this /* We will output the function; no longer consider it in this
loop. */ loop. */
......
// PR c++/80831
// { dg-options -fsyntax-only }
// { dg-do compile { target c++11 } }
class A
{
public:
virtual ~A() { }
};
class B { };
class C : public A { };
template<class J>
class D : public C
{
public:
D() { }
~D() { }
};
class E
{
public:
static E& p();
B q();
template<class J>
B q(void (J::*r)())
{
new D<J>();
return q();
}
};
void t()
{
class F
{
public:
virtual void s() { }
};
E& x = E::p();
B y = x.q(&F::s);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment