Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UB on signed overflow in mulh routine #1539

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Conversation

aswaterman
Copy link
Collaborator

We want to evaluate whether the product of a and b is zero mod 2^64, but the product might overflow, resulting in UB. If we instead perform the computation in unsigned arithmetic, the overflow behavior is defined.

Resolves #1538

We want to evaluate whether the product of a and b is zero mod 2^64,
but the product might overflow, resulting in UB.  If we instead perform
the computation in unsigned arithmetic, the overflow behavior is defined.

Resolves #1538
@aswaterman aswaterman merged commit b98de6f into master Dec 14, 2023
3 checks passed
@aswaterman aswaterman deleted the fix-signed-overflow branch December 14, 2023 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mulh implementation when compiled with clang 16.0.0+/icc2023.2.1+ and -O2 no longer works
2 participants