Skip to content

Conversation

@chfast
Copy link
Owner

@chfast chfast commented Nov 13, 2025

For udivrem with divisor being uint128 (2 words) the Knuth division branch is dead because it handles divisors with more than 2 words.

However, the compiler or static analyzer will compile this branch and report array out-of-bounds access (e.g. GCC-15, Clang Analyzer 21).

Fix this by adding more hints about expected value ranges.

For `udivrem` with divisor being `uint128` (2 words) the Knuth division
branch is dead because it handles divisors with more than 2 words.

However, the compiler or static analyzer will compile this branch
and report array out-of-bounds access (e.g. GCC-15, Clang Analyzer 21).

Fix this by adding more hints about expected value ranges.
@sonarqubecloud
Copy link

@chfast chfast merged commit f6c49c5 into master Nov 13, 2025
20 checks passed
@chfast chfast deleted the div_test branch November 13, 2025 15:03
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.

2 participants