diff -up lua-5.4.0/src/lgc.c.bug8 lua-5.4.0/src/lgc.c --- lua-5.4.0/src/lgc.c.bug8 2020-07-31 10:55:37.427116603 -0400 +++ lua-5.4.0/src/lgc.c 2020-07-31 10:57:04.639314417 -0400 @@ -856,6 +856,8 @@ static void GCTM (lua_State *L) { if (unlikely(status != LUA_OK)) { /* error while running __gc? */ luaE_warnerror(L, "__gc metamethod"); L->top--; /* pops error object */ + if (isLua(L->ci)) + L->oldpc = L->ci->u.l.savedpc; /* update 'oldpc' */ } } }