[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: possible bug in yield-patch
- From: "Arvid Norberg" <c99ang@...>
- Date: Fri, 4 Jan 2002 19:34:41 +0100
When I run the following program, it will be caught in an infinite-loop
trying to pop the callinfo stack (line 514 in ldo.c). It looks like the
L->callinfostack
points to the stackframe below baseci. So all stack frames are popped
and eventually the callinfostack is set to 0. From there, there's no return.
extern "C"
{
#include "lua.h"
#include "lualib.h"
}
#include <windows.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
{
lua_State *L = lua_open(1000);
lua_baselibopen(L);
lua_dostring(L, "function my_func() yield() end");
// call my_func() and then do something illegal (that will cause a
runtime-error)
lua_dostring(L, "my_func() if (nil > nil) then end");
// now, execute the code that causes a runtime-error
// this call does not return
lua_resume(L);
lua_close(L);
return 0;
}
It seems to be a windows-specific problem. It will only occur when
compiled as a Win32 application. If I compile the program as a Win32 console
application it works as expected.
I'm using lua 4.0 with the yield-patch.
---
Arvid Norberg