+2010-07-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44748
+ * tree-ssa-ccp.c (fold_const_aggregate_ref): Properly handle
+ the embedded conversion in MEM_REFs.
+
2010-07-01 López-Ibáñez <manu@gcc.gnu.org>
* reload.c: Include toplev.h.
+2010-07-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44748
+ * gcc.dg/tree-ssa/ssa-ccp-29.c: New testcase.
+
2010-07-02 Iain Sandoe <iains@gcc.gnu.org>
* objc-obj-c++-shared/next-abi.h: Remove dependency on system
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-ccp2" } */
+
+static double num;
+int foo (void)
+{
+ return *(unsigned *)#
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "ccp2" } } */
+/* { dg-final { cleanup-tree-dump "ccp2" } } */
if (DECL_P (base)
&& !AGGREGATE_TYPE_P (TREE_TYPE (base))
&& integer_zerop (TREE_OPERAND (t, 1)))
- return get_symbol_constant_value (base);
+ {
+ tree res = get_symbol_constant_value (base);
+ if (res
+ && !useless_type_conversion_p
+ (TREE_TYPE (t), TREE_TYPE (res)))
+ res = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (t), res);
+ return res;
+ }
if (!TREE_READONLY (base)
|| TREE_CODE (TREE_TYPE (base)) != ARRAY_TYPE