3 ms·
Stage2 is like a Band-Aid on an amputee. It is built with stage1. Any compiler built such that `if (false)` branches can run will also miscompile code, even if
by puffoflogic 4y ago
Stage2 is like a Band-Aid on an amputee. It is built with stage1. Any compiler built such that `if (false)` branches can run will also miscompile code, even if its source is 100% correct. (Spoiler alert: its source will not be 100% correct.)
- kprotty 4y ago1) Stage2 is intended as more than just fixes for stage1; It includes performance improvements, more codegen backends (direct x86/arm/wasm to avoid LLVM, C, etc.), will allow for incremental linking, hot reloading, and more. 2) The miscompilation in question is `if (false) else |capture| {}` not just `if (false)`. The latter is misinformation. 3) Miscompilations are conditional. Saying that the entire compiler is invalid given they exist is like saying rustc is invalid / can't uphold safety invariants given long standing compiler bugs allowing safe code to trigger UB / segfault [0] [1]. Both of such conclusions aren't true in practice. [0]: https://crates.io/crates/fake-static https://crates.io/crates/fake-static [1]: https://github.com/rust-lang/rust/issues/25860 https://github.com/rust-lang/rust/issues/25860
- kristoff_it 4y agoIt's not uncommon for LLVM releases to come with regressions that cause miscompilations. The compiler toolchain industry is very different from what you seem to think it is.