Closed eldesh closed 2 years ago
I found a compiler bug. The compiler accepts the following code but outputs a broken program. It mysteriously destroys the captured value v.
f (v:float) : float = go x = if x < 2.0 then x else print v go (x / 2.0) go (v / 2.0) x = f 123.0
ante test.an 123.0 61.5000 30.7500 15.3750 7.6875
Took a quick look at the hir and cranelift/llvm irs. Looks like the closure value is being referenced to like a normal lambda without its environment within the closure's recursive calls
I found a compiler bug. The compiler accepts the following code but outputs a broken program. It mysteriously destroys the captured value v.
Environment
Code
Output