[llvm-bugs] [Bug 38665] New: __builtin_mul_overflow with mixed sign gives different results compared to GCC
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 21 16:17:20 PDT 2018
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: unassignedclangbugs at nondot.org
Reporter: joerg at NetBSD.org
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180821/252530b7/attachment-0001.html>
More information about the llvm-bugs
mailing list