gc bug in 2.0.4?

  • From: Andrea Guerra <andrea.guerra.mail@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 15 Nov 2016 12:16:30 +0100

Hi List,

the following script rises a read access violation after few cycles
when executed on Win10. The exception happened on the collectgarbage()
line. I'm on luajit 2.0.4 HEAD (JIT: ON CMOV SSE2 SSE3 SSE4.1 AMD fold
cse dce fwd dse narrow loop abc sink fuse)

local ffi = require"ffi"
local cType = ffi.typeof("float[?][2]")
local t = {}
math.randomseed(1)
for i = 1, 10 do
    local counter = math.random(1000)
    for l = 1, counter do
        t[l] = {l, 0}
    end
    local z = cType(counter, t)
    collectgarbage()
    local sum = 0
    for l = 0, counter - 1 do
        sum = z[l][1] + z[l][0] + sum
    end
end

Besides the exception: I initialize the VLA (z) with a longer table
(t) than the number of elements (counter), should this rise an error
(excess initializer)?

Thanks,
Andrea

Other related posts: