Skip to content

Protect compiler inputs and strengthen Whale lowering validation - #911

Merged
LunaStev merged 2 commits into
wavefnd:masterfrom
LunaStev:fix/alpha-whale-input-protection
Oct 12, 2026
Merged

LunaStev merged 2 commits into
wavefnd:masterfrom
LunaStev:fix/alpha-whale-input-protection

Conversation

@LunaStev

Copy link
Copy Markdown
Member

Summary

Prevent compiler artifacts and validation reports from overwriting source or linker inputs. Update the Whale dependency to format 4, preserve existing numeric-condition, void-call and floating-negation semantics, and execute the supported integer lowering subset with the bounded upstream interpreter.

Motivation

AST-only output did not protect imported sources, MSVC companion output paths could alias inputs, and report guards omitted Whale sources, std files and local case imports. The Whale adapter also lacked HIR bool conversions for numeric conditions, rejected grouped void calls, and used multiplication for floating negation, which cannot preserve signaling NaN bits.

Closes #901
Closes #902
Closes #905
Closes #906
Closes #868
Closes #900
Closes #877
Closes #907
Closes #869

Related to #773. This adds its narrow integer oracle test layer, not the complete cross-backend parity harness.

Target and compatibility impact

  • Reject output aliases before writing, including hardlinks and symlinks. AST dumps still accept unavailable imports; MSVC rebuilds retain their generated-object behavior and companion rollback.
  • Keep LLVM as the default, the existing --whale CLI, supported targets and the development version unchanged.
  • Resolve the official Whale master dependency to 06577d657a242ffdd60f07db5bd788d110fc66ab; round-trip generated format-4 IR through its reader and verifier.
  • Preserve ordered numeric-to-bool conversions and lower grouped/returned void calls once. Floating negation flips only the sign bit, including signed zero and NaN payloads.
  • Oracle tests use explicit execution and memory budgets and distinguish traps, unsupported operations and incorrect results. Native Whale execution remains unsupported.

Validation

Passed with Rust 1.89.0 and local LLVM 21:

LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo +1.89 test --locked --offline --jobs 2 --workspace --all-targets --target-dir /tmp/wave-alpha-nine-target
LLVM_SYS_211_PREFIX=/usr/lib64/llvm21 cargo +1.89 clippy --locked --offline --jobs 2 --workspace --all-targets --target-dir /tmp/wave-alpha-nine-target -- -D warnings
cargo +1.89 fmt --all -- --check
python3 -m unittest tools.test_ci tools.test_check_case_sources tools.test_runtime_cases tools.test_run_tests
git diff --check
  • Rust: 401 tests passed across 46 suites. Python: 69 tests passed.
  • Regressions cover input preservation, safe output replacement, numeric conditions and short-circuiting, ordered conversions, wrapping arithmetic, shift boundaries/traps, and bounded loop/local-memory execution.
  • Floating negation tests verify and round-trip the original IR, then use an integer-carrier projection to check exact IEEE bits; these are not native floating execution tests.
  • MSVC planning, alias guards and cross-target regressions passed locally. Windows native execution remains for CI.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

Address wavefnd#901, wavefnd#902, wavefnd#905 and wavefnd#906 with pre-write alias checks and input-preservation regressions.

Signed-off-by: LunaStev <luna@lunastev.org>
Update the official format-4 dependency and address wavefnd#868, wavefnd#900, wavefnd#877, wavefnd#907 and wavefnd#869. Keep native Whale execution unsupported and the LLVM default unchanged.

Signed-off-by: LunaStev <luna@lunastev.org>
@LunaStev
LunaStev merged commit 5e23913 into wavefnd:master Oct 12, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment