Repository navigation
Preserve exception semantics in shared test comparisons - #1440
Open
agourakis82 wants to merge 1 commit into
Open
agourakis82 wants to merge 1 commit into
agourakis82 wants to merge 1 commit into
Conversation
agourakis82
marked this pull request as ready for review
November 2, 2026 10:33
agourakis82
force-pushed
the
fix/test-comparison-fp-exceptions
branch
from
November 15, 2026 20:12
1b56b9b to
6a6c9e2
Compare
Keep the Clang strict exception scope in safe_division and cover zero denominators in the existing utility tests. Assisted-by: Codex Signed-off-by: Demetrios Agourakis <demetrios@agourakis.med.br>
agourakis82
force-pushed
the
fix/test-comparison-fp-exceptions
branch
from
November 15, 2026 20:59
6a6c9e2 to
2828bb4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The power-test failure was addressed upstream by fb285a4. This revision removes the redundant power-test pragma and keeps the remaining fix in the shared
safe_divisionhelper.On current master, Clang 18 with C++23,
-O3 -march=x86-64-v3can speculate a division past its zero-denominator guard. Runtime arrays return the expected values but raiseFE_INVALID; with invalid-operation traps enabled, the process receivesSIGFPE. A scoped Clang exception pragma preserves the existing guards without changing their arithmetic. It is disabled under fast-math and on WebAssembly, whose FP exceptions/status flags are not observable. No production headers change.The regression is in the existing utility tests and covers float/double, zero and nonzero numerators over zero, and ordinary division. It restores the floating-point environment before assertions. Value checks run in fast-math too, using the existing project comparator for ordinary division in that profile.
Validation on the revised patch:
FE_INVALID, while value checks pass. Restoring the pragma passes both. Separate native trap controls distinguish signal 8 from exit 0.The preceding revision passed 19/20 upstream workflows, including Windows and sanitizer; Emscripten hit the compiler crash above. The revised head's CI is pending. Native controls and the utility tests were rerun after adding the target guard; the full native suite figures above are from before that target-only change.
Prepared with OpenAI Codex assistance, including implementation, validation and independent code review.