lua-users home
lua-l archive

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

I wrote in a response to Mike Pall:
> The segmentation fault I was getting was actually occurring when the
> process exits, not sure why GCC couldn't give me any backtrace.
> If I run from the command line this highlights the problem I'm now having: 
> LuaJIT 2.0.0-beta9 -- Copyright (C) 2005-2011 Mike Pall.
> JIT: ON fold cse dce fwd dse narrow loop abc fuse
> > for i=1,200 do if i > 100 then end end
> > print("yo")
> yo
> > os.exit(0)
> Segmentation fault

It is crashing when main() returns, which I guess might mean that there has been stack corruption? It doesn't look like luajit has installed any signal handlers or that there is any other code that should run within the luajit source base after return from main, so I'm not sure how to proceed.

When I add this print in main, and run "luajit sieve.lua"
  int main(int argc, char **argv)
  { ...
    printf("and we are out\n")
    return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
I get:
and we are out
Segmentation fault

When I run with -joff no segfault occurs on exit.  Any ideas on how I should go about trying to determine why this segfault is occurring?  I have not modified any of the LuaJIT code base except to add the __ashldi3 function, which isn't directly called by luajit and the compiler should have linked in anyway, not sure why it didn't, but I verified __ashldi3 is working correctly with the C code implementation I added.
~ Jeff