Commit 16b29cc4 by Joseph Myers Committed by Joseph Myers

tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also recurse on an…

tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also recurse on an invariant address if a conversion from a pointer type to a...

	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also
	recurse on an invariant address if a conversion from a pointer
	type to a wider integer type is involved.

testsuite:
	* gcc.c-torture/compile/ptr-conv-1.c: New test.

From-SVN: r147570
parent 934432b6
2009-05-15 Joseph Myers <joseph@codesourcery.com>
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also
recurse on an invariant address if a conversion from a pointer
type to a wider integer type is involved.
2009-05-15 Jan Hubicka <jh@suse.cz>
* cgraph.c (dump_cgraph_node): Dump size/time/benefit.
......
2009-05-15 Joseph Myers <joseph@codesourcery.com>
* gcc.c-torture/compile/ptr-conv-1.c: New test.
2009-05-14 Ian Lance Taylor <iant@google.com>
* gcc.dg/Wcxx-compat-9.c: New testcase.
......
/* The intermediate conversion to __PTRDIFF_TYPE__ could be lost,
resulting in an "invalid types in nop conversion" ICE. */
long long a;
void
f (void)
{
int c = 1;
volatile int *p = &c;
a = (long long) (__PTRDIFF_TYPE__) p;
*p;
}
......@@ -739,7 +739,11 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
address which we cannot do in a single statement. */
if (!single_use_p
|| (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (def_rhs))
&& !is_gimple_min_invariant (def_rhs)))
&& (!is_gimple_min_invariant (def_rhs)
|| (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
&& POINTER_TYPE_P (TREE_TYPE (def_rhs))
&& (TYPE_PRECISION (TREE_TYPE (lhs))
> TYPE_PRECISION (TREE_TYPE (def_rhs)))))))
return forward_propagate_addr_expr (lhs, def_rhs);
gimple_assign_set_rhs1 (use_stmt, unshare_expr (def_rhs));
......
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