lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I have recently begun experimenting with LuaJIT and ran into an issue with certain ranges of integer literals and the new LuaJIT bytecode system.

If I have the following test program defined as test.lua:

    function x()
      local v = -2130706432
      print('v: ' .. v)


Running test.lua with Lua 5.1.4 or with LuaJIT 2.0.0-beta9, I get the expected output:

   v: -2130706432

But if I use LuaJIT to generate bytecode (luajit -b test.lua test.out) and then run the bytecode version I get:

   v: 16777216 

I have reproduced this with LuaJIT 2.0.0-beta9 on OS X 10.7.3 (x86_64) and Ubuntu 11.10 32-bit. Any ideas what's happening here? Is something going wrong (de)serializing the literal in the bytecode? 

Loren Kirkby