Commit d3647516 by Jan Hubicka Committed by Jan Hubicka

PR ipa/pr67600


	PR ipa/pr67600
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::get_dynamic_type): Do not confuse
	instance offset with offset of outer type.
	* g++.dg/torture/pr67600.C: New testcase.

From-SVN: r229279
parent 3c7a8ece
2015-10-23 Jan Hubicka <hubicka@ucw.cz> 2015-10-23 Jan Hubicka <hubicka@ucw.cz>
PR ipa/pr67600
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::get_dynamic_type): Do not confuse
instance offset with offset of outer type.
* g++.dg/torture/pr67600.C: New testcase.
2015-10-23 Jan Hubicka <hubicka@ucw.cz>
* fold-const.c (operand_equal_p): Handle VIEW_CONVERT_EXPR. * fold-const.c (operand_equal_p): Handle VIEW_CONVERT_EXPR.
2015-10-23 Caroline Tice <cmtice@google.com> 2015-10-23 Caroline Tice <cmtice@google.com>
...@@ -1512,6 +1512,7 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance, ...@@ -1512,6 +1512,7 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
/* Remember OFFSET before it is modified by restrict_to_inner_class. /* Remember OFFSET before it is modified by restrict_to_inner_class.
This is because we do not update INSTANCE when walking inwards. */ This is because we do not update INSTANCE when walking inwards. */
HOST_WIDE_INT instance_offset = offset; HOST_WIDE_INT instance_offset = offset;
tree instance_outer_type = outer_type;
if (otr_type) if (otr_type)
otr_type = TYPE_MAIN_VARIANT (otr_type); otr_type = TYPE_MAIN_VARIANT (otr_type);
...@@ -1599,7 +1600,7 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance, ...@@ -1599,7 +1600,7 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
} }
} }
/* If we failed to look up the refernece in code, build our own. */ /* If we failed to look up the reference in code, build our own. */
if (!instance_ref) if (!instance_ref)
{ {
/* If the statement in question does not use memory, we can't tell /* If the statement in question does not use memory, we can't tell
...@@ -1637,13 +1638,13 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance, ...@@ -1637,13 +1638,13 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
print_generic_expr (dump_file, otr_object, TDF_SLIM); print_generic_expr (dump_file, otr_object, TDF_SLIM);
fprintf (dump_file, " Outer instance pointer: "); fprintf (dump_file, " Outer instance pointer: ");
print_generic_expr (dump_file, instance, TDF_SLIM); print_generic_expr (dump_file, instance, TDF_SLIM);
fprintf (dump_file, " offset: %i (bits)", (int)offset); fprintf (dump_file, " offset: %i (bits)", (int)instance_offset);
fprintf (dump_file, " vtbl reference: "); fprintf (dump_file, " vtbl reference: ");
print_generic_expr (dump_file, instance_ref, TDF_SLIM); print_generic_expr (dump_file, instance_ref, TDF_SLIM);
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
tci.offset = offset; tci.offset = instance_offset;
tci.instance = instance; tci.instance = instance;
tci.vtbl_ptr_ref = instance_ref; tci.vtbl_ptr_ref = instance_ref;
gcc_assert (TREE_CODE (instance) != MEM_REF); gcc_assert (TREE_CODE (instance) != MEM_REF);
...@@ -1709,9 +1710,12 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance, ...@@ -1709,9 +1710,12 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
&& !dynamic && !dynamic
&& !tci.seen_unanalyzed_store && !tci.seen_unanalyzed_store
&& !tci.multiple_types_encountered && !tci.multiple_types_encountered
&& offset == tci.offset && ((offset == tci.offset
&& types_same_for_odr (tci.known_current_type, && types_same_for_odr (tci.known_current_type,
outer_type))) outer_type))
|| (instance_offset == offset
&& types_same_for_odr (tci.known_current_type,
instance_outer_type)))))
{ {
if (!outer_type || tci.seen_unanalyzed_store) if (!outer_type || tci.seen_unanalyzed_store)
return false; return false;
......
2015-10-23 Jan Hubicka <hubicka@ucw.cz>
PR ipa/pr67600
* g++.dg/torture/pr67600.C: New testcase.
2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com> 2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com>
* g++.dg/pr68062.C: New test. * g++.dg/pr68062.C: New test.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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