[llvm-bugs] [Bug 33442] New: UBSAN: right shift by negative value is not caught for some values

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 13 14:02:50 PDT 2017


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

            Bug ID: 33442
           Summary: UBSAN: right shift by negative value is not caught for
                    some values
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk
RHS of shift operator is negative, but UBSAN doesn't trigger. Effect is value
sensitive (change to x-1 to see that UBSAN triggers). Computation in the
example do not involve overflow/underflow.

> cat f.cpp
long long int x = -2869500996303312813LL;
int i;
int main() {
  i = 0 >> (x - 280373316);
  return 0;
}

> clang++ -std=c++11 -fsanitize=undefined f.cpp -o out
> ./out

-- 
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/20170613/91f598b3/attachment.html>


More information about the llvm-bugs mailing list