Bug in Clang on macOS related to __builtin_subc

Albin Ahlbäck albin.ahlback at gmail.com
Tue Sep 3 11:58:51 CEST 2024


Hello,

In FLINT, we recently got a bug report related to our `longlong.h` 
header yielding incorrect results on ARM64 macOS [1]. The problem seems 
to be a compiler bug with __builtin_subc, an intrinsic for subtraction 
with borrow, on the following version of Clang and XCode:

$ clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 14.3.1.0.1.1683849156
volume: /
location: /
install-time: 1707543067

I know this intrinsics is neither in GMP nor MPFR, but I know it is in 
MPFR's TODO list. Thought I'd just let you know.

Best,
Albin

[1]: https://github.com/flintlib/flint/issues/2048


More information about the gmp-devel mailing list