http://llvm.org/bugs/show_bug.cgi?id=19534

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to