re PR tree-optimization/37664 (ice in remove_range_assertions, at tree-vrp.c:5116)
authorJakub Jelinek <jakub@redhat.com>
Thu, 16 Oct 2008 12:32:01 +0000 (14:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 16 Oct 2008 12:32:01 +0000 (14:32 +0200)
PR tree-optimization/37664
* fold-const.c (fold_binary): When optimizing comparison with
highest or lowest type's value, don't consider TREE_OVERFLOW.

* gcc.c-torture/compile/pr37664.c: New test.

From-SVN: r141171

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr37664.c [new file with mode: 0644]

index 13d987a712c6c42ef1d23e5c363974bec7b17b56..b242191716ba448f77c388d60e121853baf0e323 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/37664
+       * fold-const.c (fold_binary): When optimizing comparison with
+       highest or lowest type's value, don't consider TREE_OVERFLOW.
+
 2008-10-16  David Edelsohn  <edelsohn@gnu.org>
 
        PR target/35483
index 0ce122a15545b3f57362ce781703d55bd6099460..605caa812e08df824abea2c21632effe33a338ce 100644 (file)
@@ -12447,7 +12447,6 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
        unsigned int width = TYPE_PRECISION (arg1_type);
 
        if (TREE_CODE (arg1) == INTEGER_CST
-           && !TREE_OVERFLOW (arg1)
            && width <= 2 * HOST_BITS_PER_WIDE_INT
            && (INTEGRAL_TYPE_P (arg1_type) || POINTER_TYPE_P (arg1_type)))
          {
index dd4544b615590d1e9939fbd55f53c02b44b162fd..9148684b63c36462a302f5082ddd6f097bd58406 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/37664
+       * gcc.c-torture/compile/pr37664.c: New test.
+
 2008-10-16  Joseph Myers  <joseph@codesourcery.com>
 
        PR middle-end/37418
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37664.c b/gcc/testsuite/gcc.c-torture/compile/pr37664.c
new file mode 100644 (file)
index 0000000..cf5c83d
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR tree-optimization/37664 */
+
+int v;
+
+int
+foo ()
+{
+  int a = 0x8899A862;
+  int b = 0x8E * a;
+  int c = (b % b);
+  if (v > (4294967295U >> c))
+    return v;
+  return 0;
+}