|
I am talking about lua5.4 work2. In fact it can't be reproduced on gcc or lua5.3.
--actboy168
发件人: Jonathan Goble
发送时间: 2018年12月18日 10:41
收件人: Lua mailing list
主题: Re: [ 5.4 work2 ] Stack overflow causes crash
On Mon, Dec 17, 2018 at 8:44 PM actboy168 <actboy168@gmail.com> wrote:
local function test()
test()
end
test()
In lua compiled in msvc2017, this code will cause a crash.
--actboy168
When you say crash, do you mean other than a normal Lua error and traceback? An error and traceback is to be expected with this code since infinite recursion like this will eventually overflow the call stack. This is what I get on Linux, compiled with gcc:
$ lua
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
> do
>> local function test()
>> test()
>> end
>> test()
>> end
stdin:3: stack overflow
stack traceback:
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
...
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in upvalue 'test'
stdin:3: in local 'test'
stdin:5: in main chunk
[C]: in ?
If that's what you're getting, then the behavior is correct. On the other hand, if you're getting a segmentation fault or some other strange non-Lua error, then I'm sure the Lua team would appreciate more details as to exactly what is occurring.