Repository navigation
Fix numeric lowering and standard-library boundary handling - #707
Merged
LunaStev merged 12 commits intoSep 24, 2026
Merged
Conversation
Resolve literal arithmetic from its integer destination or typed peer before lowering. Diagnose operands that exceed that type and retain integer division semantics at float conversion sites. Fixes wavefnd#702 Signed-off-by: LunaStev <[email protected]>
Make NaN unequal in all float comparison paths. Cover both operand orders, mixed numeric operands, and finite values at O0 and O2. Fixes wavefnd#682 Signed-off-by: LunaStev <[email protected]>
Preserve signed zero and NaN payloads by using LLVM floating-point negation. Check exact f32 and f64 bit patterns at O0 and O2. Fixes wavefnd#683 Signed-off-by: LunaStev <[email protected]>
Use a half-open allocation range when detecting self-appends. Exercise adjacent allocations, moving growth, interior sources, and failure-state preservation with a controlled allocator. Fixes wavefnd#676 Signed-off-by: LunaStev <[email protected]>
Return the buffer overflow error and restore the original length when capacity cannot be doubled. Cover overflow, guard bytes, and normal empty and growing file reads. Fixes wavefnd#597 Signed-off-by: LunaStev <[email protected]>
Account for both the fallback dot and its terminator before writing. Cover empty and filename-only inputs with zero, one, and two-byte capacities and guard bytes. Fixes wavefnd#521 Signed-off-by: LunaStev <[email protected]>
Require fully qualified drive or UNC paths on Windows and a leading slash on POSIX targets. Cover drive-relative and root-relative inputs and compile path regressions for Windows x64 and ARM64. Fixes wavefnd#529 Signed-off-by: LunaStev <[email protected]>
Clamp dirname trimming at the target-recognized drive root while preserving POSIX and existing trailing-separator behavior. Check exact output and destination guards. Fixes wavefnd#677 Signed-off-by: LunaStev <[email protected]>
Find the final non-root component before trailing separators and bound extension scanning to it. Preserve root-only empty basenames and existing dirname behavior. Fixes wavefnd#592 Signed-off-by: LunaStev <[email protected]>
Fold nanosecond carry or borrow into a safe operand before checking the seconds operation. Cover representable boundary results and checked/saturating agreement with integer-oracle cases. Fixes wavefnd#522 Signed-off-by: LunaStev <[email protected]>
Hash unsigned bytes with wrapping u64 arithmetic and return the existing i64 bit pattern. Document the corrected output and check empty, ASCII, and UTF-8 vectors. Fixes wavefnd#547 Signed-off-by: LunaStev <[email protected]>
Clamp the right endpoint to the left endpoint for all-whitespace strings. Check empty, whitespace-only, and content-bearing inputs without changing the individual trim helpers. Fixes wavefnd#548 Signed-off-by: LunaStev <[email protected]>
Open
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.
Summary
Fix twelve compiler and standard-library correctness issues, with one DCO-signed commit per issue and regression coverage alongside each change.
For example, comparing a
u64value against4294967296 - 32now uses the bound4294967264, instead of truncating the expression toi32and extending-32.Motivation
!=returns true for unordered NaN comparisons in all numeric paths.fneg, preserving signed-zero and NaN payload behavior.read_to_endreports capacity-doubling overflow and restores the original buffer length..fallback reserves space for both the dot and its terminator before writing.C:\.The saved pre-change compiler and standard library reproduced failures in eleven focused programs covering all twelve issues, including the original #702 reproducer. The Windows path issues share one regression program.
Target and compatibility impact
i32fallback; out-of-range operands are diagnosed before truncation. Integer division still occurs before conversion to a floating-point destination.i64return type still exposes the 64-bit hash bit pattern. API comments document this change and the path/trim conventions.Validation
Cargo commands used
LLVM_SYS_211_PREFIX=/usr/lib64/llvm21and--jobs 2for builds and tests.cargo fmt --all --check,git diff --check, and whitespace checks for every commit../tools/check_std_policy.sh.RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps --jobs 2.cargo clippy --locked --workspace --all-targets --jobs 2 -- -D warnings.CONTRIBUTING.md;python3 -m unittest tools.test_case_manifest tools.test_test_contracts tools.test_process_tree: 38 tests, one skip.cargo build --locked --release --jobs 2;python3 tools/check_wave_corpus.py --wavec target/release/wavec --run-std-examples: 288 corpus checks and 26 std examples passed.cargo test --locked --workspace --all-targets --jobs 2: completed suites passed except one existing async TCP regression blocked by the sandbox's local-socket restrictions. That exact regression passed when rerun with socket access; the remaining frontend, runtime, and std-I/O suites also passed with that access. Parser tests and all 13 new boundary regression tests passed; executable boundary cases run at both-O0and-O2.Checklist
Signed-off-byline.std/.