https://sourceware.org/bugzilla/show_bug.cgi?id=19311

--- Comment #13 from Loria <Loria at phantasia dot org> ---
<QUOTE https://llvm.org/bugs/show_bug.cgi?id=26344 <>
$ 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.
</QUOTE>
I am unsure if that is correct, since I never experienced on any machine any
problem doing >>32 (resulted in 0 as expected on all machines i did it)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to