Commit add5c763 by Jakub Jelinek Committed by Jakub Jelinek

re PR ipa/59947 (Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type)

	PR ipa/59947
	* ipa-devirt.c (possible_polymorphic_call_targets): Fix
	a comment typo and formatting issue.  If odr_hash hasn't been
	created, return vNULL and set *completep to false.

	* g++.dg/opt/pr59947.C: New test.

From-SVN: r207512
parent 54e19c00
2014-02-05 Jakub Jelinek <jakub@redhat.com> 2014-02-05 Jakub Jelinek <jakub@redhat.com>
PR ipa/59947
* ipa-devirt.c (possible_polymorphic_call_targets): Fix
a comment typo and formatting issue. If odr_hash hasn't been
created, return vNULL and set *completep to false.
PR middle-end/57499 PR middle-end/57499
* tree-eh.c (cleanup_empty_eh): Bail out on totally empty * tree-eh.c (cleanup_empty_eh): Bail out on totally empty
bb with no successors. bb with no successors.
......
...@@ -1359,7 +1359,7 @@ devirt_variable_node_removal_hook (varpool_node *n, ...@@ -1359,7 +1359,7 @@ devirt_variable_node_removal_hook (varpool_node *n,
temporarily change to one of base types. INCLUDE_DERIVER_TYPES make temporarily change to one of base types. INCLUDE_DERIVER_TYPES make
us to walk the inheritance graph for all derivations. us to walk the inheritance graph for all derivations.
If COMPLETEP is non-NULL, store true if the list is complette. If COMPLETEP is non-NULL, store true if the list is complete.
CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
in the target cache. If user needs to visit every target list in the target cache. If user needs to visit every target list
just once, it can memoize them. just once, it can memoize them.
...@@ -1378,7 +1378,7 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1378,7 +1378,7 @@ possible_polymorphic_call_targets (tree otr_type,
static struct cgraph_node_hook_list *node_removal_hook_holder; static struct cgraph_node_hook_list *node_removal_hook_holder;
pointer_set_t *inserted; pointer_set_t *inserted;
pointer_set_t *matched_vtables; pointer_set_t *matched_vtables;
vec <cgraph_node *> nodes=vNULL; vec <cgraph_node *> nodes = vNULL;
odr_type type, outer_type; odr_type type, outer_type;
polymorphic_call_target_d key; polymorphic_call_target_d key;
polymorphic_call_target_d **slot; polymorphic_call_target_d **slot;
...@@ -1386,6 +1386,13 @@ possible_polymorphic_call_targets (tree otr_type, ...@@ -1386,6 +1386,13 @@ possible_polymorphic_call_targets (tree otr_type,
tree binfo, target; tree binfo, target;
bool final; bool final;
if (!odr_hash.is_created ())
{
if (completep)
*completep = false;
return nodes;
}
type = get_odr_type (otr_type, true); type = get_odr_type (otr_type, true);
/* Lookup the outer class type we want to walk. */ /* Lookup the outer class type we want to walk. */
......
2014-02-05 Jakub Jelinek <jakub@redhat.com> 2014-02-05 Jakub Jelinek <jakub@redhat.com>
PR ipa/59947
* g++.dg/opt/pr59947.C: New test.
PR c++/58703 PR c++/58703
* c-c++-common/gomp/pr58703.c: New test. * c-c++-common/gomp/pr58703.c: New test.
......
// PR ipa/59947
// { dg-do compile }
// { dg-options "-O0 -std=c++11" }
#pragma GCC optimize ("O2")
template <typename T>
inline void
foo (T & a) noexcept { T tmp = static_cast <T &&> (a); };
struct A
{
A () noexcept : a (1), b (1) {}
virtual void c () noexcept = 0;
void d () noexcept { c (); }
int a;
int b;
};
struct B
{
~B () noexcept { e->d (); }
A *e;
};
template <typename T>
struct C
{
B f;
};
struct D {};
template <typename T>
struct E
{
void bar () { foo (g); }
C <D> g;
};
template class E <char>;
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