+2005-05-27 Kazu Hirata <kazu@cs.umass.edu>
+
+ PR tree-optimization/21658
+ * tree-ssa-ccp.c (ccp_fold): Call fold_binary instead of
+ fold_binary_to_constant. Likewise, call fold_unary instead of
+ fold_unary_to_constant.
+
2005-05-27 Nathan Sidwell <nathan@codesourcery.com>
* vec.h: Implement integral type vector specialization.
+2005-05-27 Kazu Hirata <kazu@cs.umass.edu>
+
+ PR tree-optimization/21658
+ * gcc.dg/tree-ssa/pr21658.c: New.
+
2005-05-27 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21455
--- /dev/null
+/* PR tree-optimization/21658
+ CCP did not propagate an ADDR_EXPR far enough, preventing the "if"
+ statement below from being folded. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-ccp-details" } */
+
+void link_error (void);
+
+void
+f (void)
+{
+ int a[10];
+ int *p = &a[5];
+ int *q = p - 1;
+ if (q != &a[4])
+ link_error ();
+}
+
+/* { dg-final { scan-tree-dump-times "with if \\(0\\)" 1 "ccp"} } */
+/* { dg-final { cleanup-tree-dump "ccp" } } */
op0 = get_value (op0, true)->value;
}
- retval = fold_unary_to_constant (code, TREE_TYPE (rhs), op0);
+ retval = fold_unary (code, TREE_TYPE (rhs), op0);
/* If we folded, but did not create an invariant, then we can not
use this expression. */
op1 = val->value;
}
- retval = fold_binary_to_constant (code, TREE_TYPE (rhs), op0, op1);
+ retval = fold_binary (code, TREE_TYPE (rhs), op0, op1);
/* If we folded, but did not create an invariant, then we can not
use this expression. */