openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.24k stars 200 forks source link

MIPS environment has a bug in version 20220310 #152

Closed lison0322 closed 2 years ago

lison0322 commented 2 years ago

ARCH:mipsel Hardware: MT7621 Kernel: 5.10 GCC: 8.4.0 SDK:openwrt master Problem version: luajit2-20220310 Normal version: luajit2-20220309

Example:

#!/usr/bin/luajit

function ip2int(ip)
    local ipnum=0
    local n=4

    ip:gsub("([0-9]+)", function(i)
        n = n - 1
        ipnum = ipnum + i*(256^n)
    end)

    print(ip, ipnum, (ipnum == 4294967040) and "ok" or "error")
end

for i=0,50 do
    ip2int("255.255.255.0")
end

Result:

255.255.255.0   4294967040      ok
255.255.255.0   4294967040      ok
255.255.255.0   4294967040      ok
255.255.255.0   4294967040      ok
255.255.255.0   4294967040      ok
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   4278190590      error
255.255.255.0   765     error
255.255.255.0   765     error
255.255.255.0   765     error
255.255.255.0   765     error
zhuizhuhaomeng commented 2 years ago

@lison0322 please report the bug to upstream luajit https://github.com/LuaJIT/LuaJIT