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

            Bug ID: 38665
           Summary: __builtin_mul_overflow with mixed sign gives different
                    results compared to GCC
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: jo...@netbsd.org
                CC: llvm-bugs@lists.llvm.org

Try to build:

#include <stddef.h>

int f(size_t a, size_t b) {
   ptrdiff_t x;
   return __builtin_mul_overflow(a, b, &x);
}

with clang and gcc for x86_64.

(1) GCC seems to interpret this as uint64_t x uint64_t -> uint64_t
multiplication
(2) Clang seems to widen the types and goes for int128_t instead (__muloti4).

This difference in interpretation seems to break the memory overflow checks in
GNU m4.

-- 
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