Safely use nodes[0] in possible_polymorphic_call_targets

2016-03-16  Tom de Vries  <tom@codesourcery.com>

	PR lto/70187
	* ipa-devirt.c (possible_polymorphic_call_targets): Move
	nodes.length () == 1 test to before first nodes[0] access.

From-SVN: r234253
This commit is contained in:
Tom de Vries 2016-03-16 10:21:27 +00:00 committed by Tom de Vries
parent b462f86075
commit 448476ff53
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR lto/70187
* ipa-devirt.c (possible_polymorphic_call_targets): Move
nodes.length () == 1 test to before first nodes[0] access.
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68715

View File

@ -3178,10 +3178,10 @@ possible_polymorphic_call_targets (tree otr_type,
if (!outer_type->all_derivations_known)
{
if (!speculative && final_warning_records
&& nodes.length () == 1
&& TREE_CODE (TREE_TYPE (nodes[0]->decl)) == METHOD_TYPE)
{
if (complete
&& nodes.length () == 1
&& warn_suggest_final_types
&& !outer_type->derived_types.length ())
{
@ -3197,7 +3197,6 @@ possible_polymorphic_call_targets (tree otr_type,
}
if (complete
&& warn_suggest_final_methods
&& nodes.length () == 1
&& types_same_for_odr (DECL_CONTEXT (nodes[0]->decl),
outer_type->type))
{