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 middle-end/42615] Even with -fwrapv, (3*x%3) is assumed to always be equal to 0



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-01-16 13:34 -------
Actually it doesn't optimize 3*x%3 as if it were 0 but simply uses signed
arithmetic for the modulo operation resulting in a -2 modulus.

Using ((unsigned)(3 * x)) % 3 will get what you expect.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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


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