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

            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: unassignedclangb...@nondot.org
          Reporter: v...@apple.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to