]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Safely use nodes[0] in possible_polymorphic_call_targets
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Mar 2016 10:21:27 +0000 (10:21 +0000)
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Mar 2016 10:21:27 +0000 (10:21 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234253 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ipa-devirt.c

index e7c759febda209fc5493da508e16cc4d0052e99e..3b131b0557aaa09217664b50cf50e1e449a3864d 100644 (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
index e4fb56210f6aef15288e15c761f4ff6b5cb3677d..4df171bc11607b29304e82be7e94d2a0d57c2f5a 100644 (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))
                    {