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
This commit is contained in:
Jan Hubicka 2015-10-24 01:33:58 +02:00 committed by Jan Hubicka
parent 3c7a8ece3e
commit d36475161d
4 changed files with 27931 additions and 6 deletions

View file

@ -1,3 +1,11 @@
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.

View file

@ -1512,6 +1512,7 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
/* Remember OFFSET before it is modified by restrict_to_inner_class.
This is because we do not update INSTANCE when walking inwards. */
HOST_WIDE_INT instance_offset = offset;
tree instance_outer_type = outer_type;
if (otr_type)
otr_type = TYPE_MAIN_VARIANT (otr_type);
@ -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 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,
print_generic_expr (dump_file, otr_object, TDF_SLIM);
fprintf (dump_file, " Outer instance pointer: ");
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: ");
print_generic_expr (dump_file, instance_ref, TDF_SLIM);
fprintf (dump_file, "\n");
}
tci.offset = offset;
tci.offset = instance_offset;
tci.instance = instance;
tci.vtbl_ptr_ref = instance_ref;
gcc_assert (TREE_CODE (instance) != MEM_REF);
@ -1709,9 +1710,12 @@ ipa_polymorphic_call_context::get_dynamic_type (tree instance,
&& !dynamic
&& !tci.seen_unanalyzed_store
&& !tci.multiple_types_encountered
&& offset == tci.offset
&& types_same_for_odr (tci.known_current_type,
outer_type)))
&& ((offset == tci.offset
&& types_same_for_odr (tci.known_current_type,
outer_type))
|| (instance_offset == offset
&& types_same_for_odr (tci.known_current_type,
instance_outer_type)))))
{
if (!outer_type || tci.seen_unanalyzed_store)
return false;

View file

@ -1,3 +1,8 @@
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>
* g++.dg/pr68062.C: New test.

File diff suppressed because it is too large Load diff