Commit 4c8836c6 by Jan Hubicka Committed by Jan Hubicka

re PR tree-optimization/51694 (ICE while compiling alliance package)

	PR tree-optimize/51694
	* ipa-cp.c (ipa_get_indirect_edge_target): Add bounds checks.

From-SVN: r182993
parent 11f30bb0
2012-01-08 Jan Hubicka <jh@suse.cz>
PR tree-optimize/51694
* ipa-cp.c (ipa_get_indirect_edge_target): Add bounds checks.
2012-01-08 Jonathan Wakely <jwakely.gcc@gmail.com>
* doc/cpp.texi (Predefined Macros): __STRICT_ANSI__ is defined
......@@ -1112,7 +1112,8 @@ ipa_get_indirect_edge_target (struct cgraph_edge *ie,
if (!ie->indirect_info->polymorphic)
{
tree t = VEC_index (tree, known_vals, param_index);
tree t = (VEC_length (tree, known_vals) > param_index
? VEC_index (tree, known_vals, param_index) : NULL);
if (t &&
TREE_CODE (t) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL)
......@@ -1126,7 +1127,7 @@ ipa_get_indirect_edge_target (struct cgraph_edge *ie,
otr_type = ie->indirect_info->otr_type;
t = VEC_index (tree, known_vals, param_index);
if (!t && known_binfos)
if (!t && known_binfos && VEC_length (tree, known_binfos) > param_index)
t = VEC_index (tree, known_binfos, param_index);
if (!t)
return NULL_TREE;
......
2012-01-07 Jan Hubicka <jh@suse.cz>
PR tree-optimize/51694
* gcc.c-torture/compile/pr51694.c: new testcase.
2012-01-07 Jan Hubicka <jh@suse.cz>
PR tree-optimization/51600
* g++.dg/torture/pr51600.C: New testcase.
......
void
foo (x, fn)
void (*fn) ();
{
int a = baz ((void *) 0, x);
(*fn) (x, 0);
}
void
bar (void)
{
void *x = 0;
foo (x);
}
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