This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/53986] missing vrp on bit-mask test, LSHIFT_EXPR not handled


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53986

--- Comment #6 from vries at gcc dot gnu.org 2012-08-05 13:32:15 UTC ---
> s_1         (u)s_1      s_1+16      ((u)s_1)+16      T T
> -16         4294967280  0           0                0 0
> -12         4294967284  4           4                0 0
> -9          4294967287  7           7                0 0
> -17         4294967279  -1          4294967295       0 1
> $

I think you forgot the cast to unsigned after the add that represents the
currently generated code:
...
@@ -13,7 +13,7 @@
       unsigned int uv = (unsigned) v;
       printf ("%-12d%-12u%-12d%-12u\t%2d%2d\n",
           v, uv, v+16, uv+16,
-          (v+16) > 7, (uv+16) > 7);
+          (unsigned int)(v+16) > 7, (uv+16) > 7);
     }
   return 0;
 }
...

With that added I see:
...
s_1         (u)s_1      s_1+16      ((u)s_1)+16      T T
-16         4294967280  0           0                0 0
-12         4294967284  4           4                0 0
-9          4294967287  7           7                0 0
-17         4294967279  -1          4294967295       1 1
...

We now see the correct result for all 4 cases for both methods.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]