lua-users home
lua-l archive

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


I tried this on the latest and greatest (OS X 10.8.x and Xcode 5). The problem does not occur there. This must be version specific (compiler or OS).



On Wed, Oct 2, 2013 at 3:53 PM, Paul K <paulclinger@yahoo.com> wrote:
Hi All,

I get a strange crash on OSX 10.7.4 running Lua 5.2.2 with this simple script:

print("Start", _VERSION)
local f = assert(io.open("test.dat", "wb"))
f:write("Hello")
print("Written hello")
f:close()
print("Closed")

The crash seems to happen on f:close(). I only get the crash when I
compile Lua with -arch i386. Lua 5.1.5 runs fine and Lua 5.2.2 runs
fine when compiled with (default) x86_64. If I remove f:close(), I get
no error. I tried to play with make options compiling it statically
and dynamically, but it always crashes if I compile with -arch i386.

make command: make MYCFLAGS="-arch i386" MYLDFLAGS="-arch i386" macosx

GDB output with a stack trace:

Start Lua 5.2
Written hello

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x0000a310 in luaD_precall ()
#2  0x00017e55 in luaV_execute ()
#3  0x0000a56c in luaD_call ()
#4  0x000049a9 in f_call ()
#5  0x00009650 in luaD_rawrunprotected ()
#6  0x000096b8 in luaD_pcall ()
#7  0x00004907 in lua_pcallk ()
#8  0x00002584 in pmain ()
#9  0x0000a310 in luaD_precall ()
#10 0x0000a560 in luaD_call ()
#11 0x000049a9 in f_call ()
#12 0x00009650 in luaD_rawrunprotected ()
#13 0x000096b8 in luaD_pcall ()
#14 0x00004907 in lua_pcallk ()
#15 0x00001c6b in main ()
(gdb)

What am I doing wrong?

Paul.




--