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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147570
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
--- /dev/null
+/* 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;
+}
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));