+2011-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/48717
+ * tree-ssa-forwprop.c (associate_plusminus): For A + ~A and
+ ~A + A optimizations use build_int_cst_type instead of build_int_cst.
+
2011-04-22 Uros Bizjak <ubizjak@gmail.com>
PR target/48723
+2011-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/48717
+ * gcc.c-torture/execute/pr48717.c: New test.
+
2011-04-22 Uros Bizjak <ubizjak@gmail.com>
PR target/48723
--- /dev/null
+/* PR tree-optimization/48717 */
+
+extern void abort (void);
+
+int v = 1, w;
+
+unsigned short
+foo (unsigned short x, unsigned short y)
+{
+ return x + y;
+}
+
+void
+bar (void)
+{
+ v = foo (~w, w);
+}
+
+int
+main ()
+{
+ bar ();
+ if (v != (unsigned short) -1)
+ abort ();
+ return 0;
+}
{
/* ~A + A -> -1. */
code = INTEGER_CST;
- rhs1 = build_int_cst (TREE_TYPE (rhs2), -1);
+ rhs1 = build_int_cst_type (TREE_TYPE (rhs2), -1);
rhs2 = NULL_TREE;
gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE);
gcc_assert (gsi_stmt (gsi) == stmt);
{
/* A + ~A -> -1. */
code = INTEGER_CST;
- rhs1 = build_int_cst (TREE_TYPE (rhs1), -1);
+ rhs1 = build_int_cst_type (TREE_TYPE (rhs1), -1);
rhs2 = NULL_TREE;
gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE);
gcc_assert (gsi_stmt (gsi) == stmt);