diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-09-29 13:41:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-09-29 13:41:35 -0300 |
commit | 5d4bf35ec9f240fc82cd4e94a395c652b2ab004c (patch) | |
tree | 2cdee5ef31b38d6dca37dd871fcb8d21755fcc6b /bugs | |
parent | 6063c5c61f55d15ea4abb1eed05f597deaf4a9c3 (diff) | |
download | lua-5d4bf35ec9f240fc82cd4e94a395c652b2ab004c.tar.gz lua-5d4bf35ec9f240fc82cd4e94a395c652b2ab004c.tar.bz2 lua-5d4bf35ec9f240fc82cd4e94a395c652b2ab004c.zip |
bug: syntax `local function' does not increment stack size
Diffstat (limited to 'bugs')
-rw-r--r-- | bugs | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -358,7 +358,37 @@ coroutine.resume(co) | |||
358 | coroutine.resume(co) --> seg. fault | 358 | coroutine.resume(co) --> seg. fault |
359 | ]], | 359 | ]], |
360 | report = [[by Alex Bilyk, 09/05/2003]], | 360 | report = [[by Alex Bilyk, 09/05/2003]], |
361 | patch = [[???]], | 361 | patch = [[ |
362 | * ldo.c: | ||
363 | 325,326c325 | ||
364 | < if (nargs >= L->top - L->base) | ||
365 | < luaG_runerror(L, "cannot resume dead coroutine"); | ||
366 | --- | ||
367 | > lua_assert(nargs < L->top - L->base); | ||
368 | 329c328,329 | ||
369 | < else if (ci->state & CI_YIELD) { /* inside a yield? */ | ||
370 | --- | ||
371 | > else { /* inside a yield */ | ||
372 | > lua_assert(ci->state & CI_YIELD); | ||
373 | 344,345d343 | ||
374 | < else | ||
375 | < luaG_runerror(L, "cannot resume non-suspended coroutine"); | ||
376 | 351a350,358 | ||
377 | > static int resume_error (lua_State *L, const char *msg) { | ||
378 | > L->top = L->ci->base; | ||
379 | > setsvalue2s(L->top, luaS_new(L, msg)); | ||
380 | > incr_top(L); | ||
381 | > lua_unlock(L); | ||
382 | > return LUA_ERRRUN; | ||
383 | > } | ||
384 | > | ||
385 | > | ||
386 | 355a363,366 | ||
387 | > if (L->ci == L->base_ci && nargs >= L->top - L->base) | ||
388 | > return resume_error(L, "cannot resume dead coroutine"); | ||
389 | > else if (!(L->ci->state & CI_YIELD)) /* not inside a yield? */ | ||
390 | > return resume_error(L, "cannot resume non-suspended coroutine"); | ||
391 | ]], | ||
362 | } | 392 | } |
363 | 393 | ||
364 | 394 | ||
@@ -514,3 +544,27 @@ patch = [[ | |||
514 | > char buff[128]; | 544 | > char buff[128]; |
515 | ]] | 545 | ]] |
516 | } | 546 | } |
547 | |||
548 | |||
549 | Bug{ | ||
550 | what = [[syntax `local function' does not increment stack size]], | ||
551 | |||
552 | report = [[Rici Lake, 26/09/2003]], | ||
553 | |||
554 | example = [[ | ||
555 | -- must run this with precompiled code | ||
556 | local a,b,c | ||
557 | local function d () end | ||
558 | ]], | ||
559 | |||
560 | patch = [[ | ||
561 | * lparser.c: | ||
562 | 1145c1145,1146 | ||
563 | < init_exp(&v, VLOCAL, ls->fs->freereg++); | ||
564 | --- | ||
565 | > init_exp(&v, VLOCAL, ls->fs->freereg); | ||
566 | > luaK_reserveregs(ls->fs, 1); | ||
567 | ]], | ||
568 | |||
569 | } | ||
570 | |||