Felix Wu wrote:

> The following function ran fine with JIT off (-joff) for both LuaJIT

> 2.0 beta 8 and 9, but got erroneous results with JIT on. Is this a

> known bug?

>

> (1) with -joff

>

> > function fib(n) return (n < 2) and 1 or fib(n-1)+fib(n-2) end

> > = fib(10)

> 89

> > =fib(20)

> 10946

>

> (2) without -joff

>

> > function fib(n) return (n < 2) and 1 or fib(n-1)+fib(n-2) end

> > = fib(10)

> 79

> > = fib(20)

> stdin:1: attempt to perform arithmetic on a nil value

Thank you for the bug report and the test case! Fixed in git HEAD.

[That was a wrong data flow optimization hint in the bytecode.

That's why it's of rather basic nature, but only shows up under

very specific circumstances, when the code is JIT-compiled.]

--Mike