Skip to content

Conversation

allevato
Copy link
Collaborator

@allevato allevato commented Oct 7, 2025

Thanks to a heterogeneous comparison operator on BinaryInteger, the expression someUInt64 < 1 &<< 32 was compiling incorrectly on 32-bit architectures, because the right-hand side was being inferred as Int instead of UInt64. And on a 32-bit system, 1 &<< 32 is zero.

Fixes #1858.

…r.nextInt32`.

Thanks to a heterogeneous comparison operator on `BinaryInteger`, the
expression `someUInt64 < 1 &<< 32` was compiling incorrectly on
32-bit architectures, because the right-hand side was being inferred
as `Int` instead of `UInt64`. And on a 32-bit system, `1 &<< 32` is
zero.

Fixes apple#1858.
@thomasvl thomasvl added the 🔨 semver/patch No public API change. label Oct 7, 2025
@thomasvl
Copy link
Collaborator

thomasvl commented Oct 7, 2025

Aside - there's no public api addition here, but I do wonder if this should be semver/minor due to the bug in question.

@allevato
Copy link
Collaborator Author

allevato commented Oct 7, 2025

Aside - there's no public api addition here, but I do wonder if this should be semver/minor due to the bug in question.

The bytecode was introduced in 1.31.0, so if we release this fix as the next patch release (1.31.2), then users who are using upToNextMinor in their SwiftPM dependencies would get the fix automatically. Likewise, if we released it as 1.32.0, then those users wouldn't get the fix without manually updating, which would be undesirable.

@thomasvl
Copy link
Collaborator

thomasvl commented Oct 7, 2025

Aside - there's no public api addition here, but I do wonder if this should be semver/minor due to the bug in question.

The bytecode was introduced in 1.31.0, so if we release this fix as the next patch release (1.31.2), then users who are using upToNextMinor in their SwiftPM dependencies would get the fix automatically. Likewise, if we released it as 1.32.0, then those users wouldn't get the fix without manually updating, which would be undesirable.

And I guess the bug only happens to folks using TextFormat or JSON on watchOS. Binary on watchOS is fine, and TextFormat/JSON on everything else is 64bit and won't run into this problem.

@allevato allevato merged commit f8c286a into apple:main Oct 7, 2025
13 of 14 checks passed
@allevato allevato deleted the 32-bit-fix branch October 7, 2025 13:59
@FranzBusch
Copy link
Member

I think this is fine as a patch release since this looks like a relatively straightforward bug-fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"nextInt32() read a value larger than 32 bits" assertion failure on Apple Watch (S8 SoC)

3 participants