Macro 'luaC_condGC' should call pre/pos only once

With test option HARDMEMTESTS defined, luaC_condGC was calling pre and
pos twice. That made macro checkGC set the stack top before the GC
step and then again before the full collection, but the previous step
could invalidate the pointer used to set top.
This commit is contained in:
Roberto I
2026-08-28 09:27:47 -03:00
parent 7579fc9d7e
commit c0adc5f8a5

5
lgc.h
View File

@@ -231,8 +231,9 @@
#endif
#define luaC_condGC(L,pre,pos) \
{ if (G(L)->GCdebt <= 0) { pre; luaC_step(L); pos;}; \
condchangemem(L,pre,pos,0); }
{ if (G(L)->GCdebt <= 0) \
{ pre; luaC_step(L); condchangemem(L,{},{},0); pos;} \
else condchangemem(L,pre,pos,0); }
/* more often than not, 'pre'/'pos' are empty */
#define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0)