This PR was due to code in which -(int) foo was suposed to be sign-extended,
but was being ORed with an unsigned int and so ended up being zero-extended.
Fixed by using the proper-width type.

Tested on x86_64-linux-gnu and applied as obvious.  Sorry for the breakage.

Thanks,
Richard


gcc/
        PR tree-optimization/61095
        * tree-ssanames.c (get_nonzero_bits): Fix type extension in wi::shwi.

Index: gcc/tree-ssanames.c
===================================================================
--- gcc/tree-ssanames.c 2014-05-07 16:50:15.136064484 +0100
+++ gcc/tree-ssanames.c 2014-05-07 16:50:15.422063737 +0100
@@ -271,7 +271,8 @@ get_nonzero_bits (const_tree name)
     {
       struct ptr_info_def *pi = SSA_NAME_PTR_INFO (name);
       if (pi && pi->align)
-       return wi::shwi (-(int) pi->align | pi->misalign, precision);
+       return wi::shwi (-(HOST_WIDE_INT) pi->align
+                        | (HOST_WIDE_INT) pi->misalign, precision);
       return wi::shwi (-1, precision);
     }
 

Reply via email to