[LLVMbugs] [Bug 19534] New: UBSan: False positive for large left shift

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 23 14:10:18 PDT 2014


            Bug ID: 19534
           Summary: UBSan: False positive for large left shift
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: nick at indigorenderer.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The code

int x = 0;
int y = x << 40;

When instrumented with UBSan gives the error:

"runtime error: shift exponent 40 is too large for 32-bit type 'int'"

However as far as I can tell from e.g. http://stackoverflow.com/a/3785121
It's well defined to shift left by such a large amount, as long as the left
operand (x) is zero, because the result is still representable.

So UBSan shouldn't show an error in this case.

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/20140423/8021a57d/attachment.html>

More information about the llvm-bugs mailing list