Skip to content

Commit

Permalink
Fix buggy __builtin_subcll in Xcode 14.3.1 on arm64 (#294)
Browse files Browse the repository at this point in the history
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 <andrey.ashikhmin@gmail.com>
  • Loading branch information
chfast and yperbasis authored Jul 17, 2023
1 parent bc106fa commit 5df3735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Documentation of all notable changes to the **intx** project.
The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].

## [0.9.3] — unreleased

### Fixed

- Fixed buggy `__builtin_subcll` in Xcode 14.3.1 on arm64.
[294](https://github.com/chfast/intx/pull/294)

## [0.9.2] — 2023-03-11

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


[0.9.3]: https://github.com/chfast/intx/compare/v0.9.2..release/0.9
[0.9.2]: https://github.com/chfast/intx/releases/v0.9.2
[0.9.1]: https://github.com/chfast/intx/releases/v0.9.1
[0.9.0]: https://github.com/chfast/intx/releases/v0.9.0
Expand Down
3 changes: 2 additions & 1 deletion include/intx/intx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ inline constexpr result_with_carry<uint64_t> addc(
inline constexpr result_with_carry<uint64_t> subc(
uint64_t x, uint64_t y, bool carry = false) noexcept
{
#if __has_builtin(__builtin_subcll)
// Use __builtin_subcll if available (except buggy Xcode 14.3.1 on arm64).
#if __has_builtin(__builtin_subcll) && __apple_build_version__ != 14030022
if (!is_constant_evaluated())
{
unsigned long long carryout = 0; // NOLINT(google-runtime-int)
Expand Down

0 comments on commit 5df3735

Please sign in to comment.