Skip to content

drop asserts contradicted by the non-positive count guards - #323

Open
Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:stale-count-asserts
Open

Ramya-9353 wants to merge 1 commit into
google:masterfrom
Ramya-9353:stale-count-asserts

Conversation

@Ramya-9353

@Ramya-9353 Ramya-9353 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Repro: build with asserts enabled (cmake -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug, then ctest): test_bignum aborts on Assertion failed: (exponent >= 0), function MultiplyByPowerOfTen and test_dtoa on (mode == SHORTEST || mode == SHORTEST_SINGLE || requested_digits >= 0), function DoubleToAscii. Every Debug job of the ci workflow, and the scons job (built with -UNDEBUG), has failed this way on master since #318 landed; both workflows only run on push, so the PR checks never showed it.
Cause: #318 changed MultiplyByPowerOfTen, AssignPowerUInt16 and DoubleToAscii to handle a negative count with an early return and added tests for it, but left the DOUBLE_CONVERSION_ASSERTs that reject the same value directly above the new guards, so with asserts enabled the guard is unreachable and the tests abort. GenerateCountedDigits has the same assert above the count <= 0 guard from #314.
Fix: drop the four asserts so the guard beneath each one is the single behaviour in both build types. Non-negative counts are untouched; the #318 tests now pass in Debug and Release, shared and static, under ctest and the direct cctest run.

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.

1 participant