[llvm-bugs] [Bug 34920] New: __builtin_mul_overflow not lowered correctly

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 11 16:51:14 PDT 2017


            Bug ID: 34920
           Summary: __builtin_mul_overflow not lowered correctly
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vsk at apple.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19264
  --> https://bugs.llvm.org/attachment.cgi?id=19264&action=edit
Miscompilation example

We're miscompiling calls to __builtin_mul_overflow(), specifically when both
arguments have the same width but differ in signed-ness:
https://godbolt.org/g/cfmEEf (I've also attached the example file).

W're emitting calls to overflow intrinsics which return i33, i65, and i129.
These are lowered into runtime calls which aren't correct: for example,
___mulodi4 doesn't correctly report overflow for 33-bit arguments.

Should we require that arguments to the overflow intrinsics have the same
signed-ness if they have the same width? Or should we provide backend and
runtime support for these exotic overflow checks?

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/20171011/49fc654a/attachment-0001.html>

More information about the llvm-bugs mailing list