2013-11-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/59014
* gcc.c-torture/execute/pr59014-2.c: New test.
2013-11-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/59014
* tree-vrp.c (register_edge_assert_for_1): Don't look
through conversions from non-integral types or through
narrowing conversions.
* gcc.c-torture/execute/pr59014.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@210177
138bc75d-0d04-0410-961f-
82ee72b054a4
2014-05-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2013-11-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59014
+ * tree-vrp.c (register_edge_assert_for_1): Don't look
+ through conversions from non-integral types or through
+ narrowing conversions.
+
2013-11-14 Jakub Jelinek <jakub@redhat.com>
Uros Bizjak <ubizjak@gmail.com>
2014-05-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2013-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59014
+ * gcc.c-torture/execute/pr59014-2.c: New test.
+
+ 2013-11-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59014
+ * gcc.c-torture/execute/pr59014.c: New test.
+
2013-11-14 Jakub Jelinek <jakub@redhat.com>
PR target/59101
--- /dev/null
+/* PR tree-optimization/59014 */
+
+__attribute__((noinline, noclone)) long long int
+foo (long long int x, long long int y)
+{
+ if (((int) x | (int) y) != 0)
+ return 6;
+ return x + y;
+}
+
+int
+main ()
+{
+ if (sizeof (long long) == sizeof (int))
+ return 0;
+ int shift_half = sizeof (int) * __CHAR_BIT__ / 2;
+ long long int x = (3LL << shift_half) << shift_half;
+ long long int y = (5LL << shift_half) << shift_half;
+ long long int z = foo (x, y);
+ if (z != ((8LL << shift_half) << shift_half))
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/59014 */
+
+int a = 2, b, c, d;
+
+int
+foo ()
+{
+ for (;; c++)
+ if ((b > 0) | (a & 1))
+ ;
+ else
+ {
+ d = a;
+ return 0;
+ }
+}
+
+int
+main ()
+{
+ foo ();
+ if (d != 2)
+ __builtin_abort ();
+ return 0;
+}
}
else if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (op_def)))
{
- /* Recurse through the type conversion. */
- retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
- code, e, bsi);
+ /* Recurse through the type conversion, unless it is a narrowing
+ conversion or conversion from non-integral type. */
+ tree rhs = gimple_assign_rhs1 (op_def);
+ if (INTEGRAL_TYPE_P (TREE_TYPE (rhs))
+ && (TYPE_PRECISION (TREE_TYPE (rhs))
+ <= TYPE_PRECISION (TREE_TYPE (op))))
+ retval |= register_edge_assert_for_1 (rhs, code, e, bsi);
}
return retval;