rhysd / gocaml

:camel: Statically typed functional programming language implementation with Go and LLVM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Returning local function value does not work

rhysd opened this issue · comments

Repro:

let rec hof f =
    let rec h x = f x in h
in
let rec g x = x + 1 in
let f = hof g in
println_int (f 10)

Error:

[1]    44863 bus error  ./foo

at runtime.

Stack violation looks to cause this problem. So I need to introduce malloc or something to avoid it.