[llvm-bugs] [Bug 45784] New: Failure to properly handle abs with -ftrapv

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 3 04:13:26 PDT 2020


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

            Bug ID: 45784
           Summary: Failure to properly handle abs with -ftrapv
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

unsigned f(int x)
{
    return __builtin_abs(x);
}

With -O3 -ftrapv, LLVM outputs this :

f(int): # @f(int)
  mov eax, edi
  neg eax
  cmovl eax, edi
  ret

The neg should be checked to avoid overflow on INT_MIN, since `-ftrapv` is on.e

-- 
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/20200503/3e2b1b6b/attachment.html>


More information about the llvm-bugs mailing list