1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 01:52:11 +03:00
juvix/app
Łukasz Czajka 6c08cbb8d8
Avoid the -Os option when generating WebAssembly (#2378)
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.
2023-09-21 13:15:36 +01:00
..
Commands Avoid the -Os option when generating WebAssembly (#2378) 2023-09-21 13:15:36 +01:00
TopCommand Support juvix format with no argument to format a project (#2208) 2023-06-20 06:32:17 +01:00
App.hs Report termination errors after typechecking (#2318) 2023-08-30 16:38:59 +02:00
AsmInterpreter.hs Refactor Core datastructures (#1975) 2023-04-04 18:58:05 +02:00
CommonOptions.hs Support more paths (#2000) 2023-04-19 15:56:48 +01:00
Evaluator.hs Print values in juvix eval (#2179) 2023-06-06 12:35:01 +02:00
GlobalOptions.hs Global offline flag (#2335) 2023-09-05 17:11:17 +02:00
Main.hs Improve error message when input path doesn't exist (#2092) 2023-05-15 11:03:09 +02:00
TopCommand.hs Add juvix clean to remove project build artifact directory (#2018) 2023-04-21 14:21:31 +02:00