jfecher / ante

A safe, easy systems language

Home Page:http://antelang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malloc Panics with -O0 or crane_lift

eldesh opened this issue · comments

In e38231f, compiling the following code at -O0:

size: Usz = 1
main () =
  _ = malloc size

main ()

Results in the compiler panicking and outputting the following error:

$ ante  -b bug.an
thread 'main' panicked at src/cranelift_backend/context.rs:197:13:
- inst0 (v1 = call fn0(v0)): arg 0 (v0) has type i8, expected i64

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

No errors occur with -O3.

This is a duplicate of #142. The code works as expected when using malloc 1 directly.