lua-users home
lua-l archive

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


Hi.

I'm getting a consistant lua_assert() failure in
luaopen_io(), lua 5.1work5:

run: lapi.c:62: index2adr: Assertion `(((L->ci->func)->tt) == 6)' failed.

Program received signal SIGABRT, Aborted.
0x4017b811 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4017b811 in kill () from /lib/libc.so.6
#1  0x4009724a in raise () from /lib/libpthread.so.0
#2  0x4017cbf8 in abort () from /lib/libc.so.6
#3  0x40174cb1 in __assert_fail () from /lib/libc.so.6
#4  0x080e4fe5 in index2adr (L=0x81fae38, idx=-10001) at lapi.c:62
#5  0x080e596c in lua_replace (L=0x81fae38, idx=-10001) at lapi.c:202
#6  0x081052b0 in luaopen_io (L=0x81fae38) at liolib.c:491
#7  0x08058b14 in zeitscript_init (script_domain=0x816a960 "script") at scripting.c:83
#8  0x08056713 in main (argc=1, argv=0xbffff4a4) at main.c:1077
#9  0x401691f6 in __libc_start_main () from /lib/libc.so.6

The code which reproduces this is simply:

  lua_State *lstate;
  lstate = (void*)lua_open();
  if (lstate) {
    lua_atpanic(lstate, l_panic);
    luaopen_base(lstate);
    luaopen_table(lstate);
    luaopen_math(lstate);
    luaopen_io(lstate);
    luaopen_string(lstate);
    luaopen_debug(lstate);
  }

lapi.c:61-62 is:
    case LUA_ENVIRONINDEX: {
      Closure *func = curr_func(L);

An assertion in luaopen_io() seems strange because I'd assume
that almost every Lua 5.1w5 user who enables assertions would be
seeing it.  Lua's 'lua' tool undoubtedly does luaopen_io() (though
now I come to look at luaopen_stdlibs() it doesn't really resemble
the above code) presumably without a problem.  Has the convention
for opening the standard libs changed?

The code is valgrind-clean up to the time of assertion.

The lua lib has been compiled with and without optimization,
on GCC 3.1.1 and GCC 3.4snap, and the assertion remains the same.

Thanks,
--Adam
--
Adam D. Moss   -   adam@gimp.org