[llvm-bugs] [Bug 26344] failure with unrolled loops which exit in the first iteration.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 27 11:37:21 PST 2016


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

David Majnemer <david.majnemer at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |david.majnemer at gmail.com
         Resolution|---                         |INVALID

--- Comment #5 from David Majnemer <david.majnemer at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160127/f9ac7dbe/attachment.html>


More information about the llvm-bugs mailing list