Skip to content

Commit 2b39ace

Browse files
yperbasischfast
authored andcommitted
Fix buggy __builtin_subcll in Xcode 14.3.1 on arm64
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.
1 parent bc106fa commit 2b39ace

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ 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+
814
## [0.9.2] — 2023-03-11
915

1016
### Changed
@@ -179,6 +185,7 @@ and this project adheres to [Semantic Versioning].
179185
[#99](https://github.com/chfast/intx/pull/99)
180186

181187

188+
[0.9.3]: https://github.com/chfast/intx/changes/v0.9.2..release/0.9
182189
[0.9.2]: https://github.com/chfast/intx/releases/v0.9.2
183190
[0.9.1]: https://github.com/chfast/intx/releases/v0.9.1
184191
[0.9.0]: https://github.com/chfast/intx/releases/v0.9.0

include/intx/intx.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ 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+
#if __has_builtin(__builtin_subcll) && __apple_build_version__ != 14030022 // Xcode 14.3.1 has a bug on arm64.
206206
if (!is_constant_evaluated())
207207
{
208208
unsigned long long carryout = 0; // NOLINT(google-runtime-int)

0 commit comments

Comments
 (0)