diff mbox

Fix tree-optimization/57144

Message ID 5183E79F.6050100@redhat.com
State New
Headers show

Commit Message

Jeff Law May 3, 2013, 4:36 p.m. UTC
Only change is in the new test which incorporates Jakub's comments. 
Installed onto the trunk.
commit e30e5a25cb9b1888b48531d87573a833515a1e4b
Author: Jeff Law <law@redhat.com>
Date:   Thu May 2 22:19:37 2013 -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.

Comments

H.J. Lu May 3, 2013, 4:44 p.m. UTC | #1
On Fri, May 3, 2013 at 9:36 AM, Jeff Law <law@redhat.com> wrote:
>
> Only change is in the new test which incorporates Jakub's comments.
> Installed onto the trunk.
>
>
> commit e30e5a25cb9b1888b48531d87573a833515a1e4b
> Author: Jeff Law <law@redhat.com>
> Date:   Thu May 2 22:19:37 2013 -0600
>
>         PR tree-optimization/57411
                                         ^^^^^^ It should be 57144.
>         * 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
                                          ^^^^^^ It should be 57144.
>         * gcc.c-torture/execute/pr57144.c: New test.
>


--
H.J.
Jeff Law May 3, 2013, 4:49 p.m. UTC | #2
On 05/03/2013 10:44 AM, H.J. Lu wrote:
> On Fri, May 3, 2013 at 9:36 AM, Jeff Law <law@redhat.com> wrote:
>>
>> Only change is in the new test which incorporates Jakub's comments.
>> Installed onto the trunk.
>>
>>
>> commit e30e5a25cb9b1888b48531d87573a833515a1e4b
>> Author: Jeff Law <law@redhat.com>
>> Date:   Thu May 2 22:19:37 2013 -0600
>>
>>          PR tree-optimization/57411
>                                           ^^^^^^ It should be 57144.
>>          * 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
>                                            ^^^^^^ It should be 57144.
Thanks.  Fixed.
jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9e3d783..f245097 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@ 
+2013-05-02  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-02  Richard Biener  <rguenther@suse.de>
 
 	* tree-eh.c (cleanup_empty_eh_merge_phis): Remove rename_virts
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c8dc189..be30c51 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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-02  Tobias Burnus  <burnus@net-b.de>
 
 	PR fortran/57142
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr57144.c b/gcc/testsuite/gcc.c-torture/execute/pr57144.c
new file mode 100644
index 0000000..ffa2df4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr57144.c
@@ -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);
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 6ed353f..b5de683 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -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);