re PR tree-optimization/57411 (ICE: verify_ssa failed: definition in block 4 does...
authorJeff Law <law@redhat.com>
Fri, 3 May 2013 16:35:04 +0000 (10:35 -0600)
committerJeff Law <law@gcc.gnu.org>
Fri, 3 May 2013 16:35:04 +0000 (10:35 -0600)
PR tree-optimization/57411
* tree-vrp.c (simplify_cond_using_ranges): Verify the constant
operand of the condition will bit into the new type when eliminating
a cast feeding a condition.

PR tree-optimization/57411
* gcc.c-torture/execute/pr57144.c: New test.

From-SVN: r198582

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr57144.c [new file with mode: 0644]
gcc/tree-vrp.c

index 4bd0ea7cc040d26bdac5280fb4a265c64b1dc951..5d16636eadd40e438ce0035fd546fb10bc5dec40 100644 (file)
@@ -1,3 +1,10 @@
+2013-05-03  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/57411
+       * tree-vrp.c (simplify_cond_using_ranges): Verify the constant
+       operand of the condition will bit into the new type when eliminating
+       a cast feeding a condition.
+
 2013-05-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/57130
index 25a131ce64e919247ad98d0e2a7fcd564254b15b..13224770283773c416cbd58879df4dba78854966 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-02  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/57411
+       * gcc.c-torture/execute/pr57144.c: New test.
+
 2013-05-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/57130
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr57144.c b/gcc/testsuite/gcc.c-torture/execute/pr57144.c
new file mode 100644 (file)
index 0000000..ffa2df4
--- /dev/null
@@ -0,0 +1,19 @@
+extern void abort (void);
+extern void exit (int);
+
+void __attribute__ ((noinline))
+foo(int a)
+{
+  int z = a > 0 ? a : -a;
+  long long x = z;
+  if (x > 0x100000000LL)
+    abort ();
+  else
+    exit (0);
+}
+
+int
+main()
+{
+  foo (1);
+}
index 6ed353f07de7f7ea586ab2290fe5c687809f4f01..b5de683961fa4baeb1b2a5bf5e8543c5029a9f07 100644 (file)
@@ -8668,7 +8668,8 @@ simplify_cond_using_ranges (gimple stmt)
          if (range_int_cst_p (vr)
              && range_fits_type_p (vr,
                                    TYPE_PRECISION (TREE_TYPE (op0)),
-                                   TYPE_UNSIGNED (TREE_TYPE (op0))))
+                                   TYPE_UNSIGNED (TREE_TYPE (op0)))
+             && int_fits_type_p (op1, TREE_TYPE (innerop)))
            {
              tree newconst = fold_convert (TREE_TYPE (innerop), op1);
              gimple_cond_set_lhs (stmt, innerop);