Skip to content

Commit 5df3735

Browse files
chfastyperbasis
andauthored
Fix buggy __builtin_subcll in Xcode 14.3.1 on arm64 (#294)
The C++ compiler from Xcode 14.3.1 miscompiles __builtin_subcll on arm64 / Apple M1 architectures. This change disables usage of the builtin in this compiler version. Co-authored-by: yperbasis <[email protected]>
1 parent bc106fa commit 5df3735

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ Documentation of all notable changes to the **intx** project.
55
The format is based on [Keep a Changelog],
66
and this project adheres to [Semantic Versioning].
77

8+
## [0.9.3] — unreleased
9+
10+
### Fixed
11+
12+
- Fixed buggy `__builtin_subcll` in Xcode 14.3.1 on arm64.
13+
[294](https://github.com/chfast/intx/pull/294)
14+
815
## [0.9.2] — 2023-03-11
916

1017
### Changed
@@ -179,6 +186,7 @@ and this project adheres to [Semantic Versioning].
179186
[#99](https://github.com/chfast/intx/pull/99)
180187

181188

189+
[0.9.3]: https://github.com/chfast/intx/compare/v0.9.2..release/0.9
182190
[0.9.2]: https://github.com/chfast/intx/releases/v0.9.2
183191
[0.9.1]: https://github.com/chfast/intx/releases/v0.9.1
184192
[0.9.0]: https://github.com/chfast/intx/releases/v0.9.0

include/intx/intx.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ inline constexpr result_with_carry<uint64_t> addc(
202202
inline constexpr result_with_carry<uint64_t> subc(
203203
uint64_t x, uint64_t y, bool carry = false) noexcept
204204
{
205-
#if __has_builtin(__builtin_subcll)
205+
// Use __builtin_subcll if available (except buggy Xcode 14.3.1 on arm64).
206+
#if __has_builtin(__builtin_subcll) && __apple_build_version__ != 14030022
206207
if (!is_constant_evaluated())
207208
{
208209
unsigned long long carryout = 0; // NOLINT(google-runtime-int)

0 commit comments

Comments
 (0)