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

David Majnemer <david.majne...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |david.majne...@gmail.com
         Resolution|---                         |INVALID

--- Comment #5 from David Majnemer <david.majne...@gmail.com> ---
$ clang -fsanitize=undefined test.c -o test && ./test
test.c:11:13: runtime error: shift exponent 32 is too large for 32-bit type
'unsigned int'
0xA7 0xA7
0x1 0x1
0x0 0x0

line 11 has:
    if((a = rotate_left (val, i)) <= 0xFF)

expands to:
    if((a = (val << i | val >> (32 - i))) <= 0xFF)

when i == 0, we will compute:
    if((a = (val << 0 | val >> (32 - 0))) <= 0xFF)

val >> 32 is undefined behavior.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to