mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 01:52:11 +03:00
6c08cbb8d8
With `-Os` ill-typed code is generated for the following: ``` module wasmcrash.juvix; import Stdlib.Prelude open; {-# inline: false #-} I {A} (x : A) : A := x; {-# inline: false #-} I' {A} (x : A) : A := x; main : Nat := I' (I I 1); ``` Running the generated WASM file with `wasmer` or `wasmtime` gives an error: ``` Validation error: type mismatch: expected i32 but nothing on stack (at offset 740) ``` The issue occurs with clang version 16.0.5 but not 16.0.0. The issue does not occur with any other optimization option (`-O1`, `-O2`, `-O3`). There is no issue with `-Os` used with the native target. This is thus likely a bug in a specific version of LLVM. It could be theoretically some very subtle non-conformance to the C standard in our generated code, but this seems less likely. Creating a minimum C file exposing the bug would be very time-consuming, so I propose to just avoid using the `-Os` option for now. |
||
---|---|---|
.. | ||
Commands | ||
TopCommand | ||
App.hs | ||
AsmInterpreter.hs | ||
CommonOptions.hs | ||
Evaluator.hs | ||
GlobalOptions.hs | ||
Main.hs | ||
TopCommand.hs |