[llvm-bugs] [Bug 33578] Optimization introduces error when right shifting by integer width.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 23 16:06:08 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33578

Davide Italiano <davide at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |davide at freebsd.org
         Resolution|---                         |INVALID

--- Comment #1 from Davide Italiano <davide at freebsd.org> ---
I think this is UB.
Clang warns you if you fold a constant in the source.

ub.cpp:5:27: warning: shift count >= width of type [-Wshift-count-overflow]
    return ((x << 0) | (x >> (64 - 0)));
                          ^  ~~~~~~~~

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170623/e20d8cd2/attachment.html>


More information about the llvm-bugs mailing list