summaryrefslogtreecommitdiff
path: root/testes/cstack.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-13 13:39:02 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-13 13:39:02 -0300
commite1d8770f12542d34a3e32b825c95b93f8a341ee1 (patch)
tree15296aaedd195efd19192052af2192fcd7c12f54 /testes/cstack.lua
parent0f1cd0eba99ea6d383e75b9ae488d00ad541c210 (diff)
downloadlua-github-e1d8770f12542d34a3e32b825c95b93f8a341ee1.tar.gz
Fixed bug: wrong stack limit when entering a coroutine
When entering a coroutine, the computation of nCcalls added 'from->nci' to correct for preallocated CallInfos, but 'nci' includes also the Callinfos already used.
Diffstat (limited to 'testes/cstack.lua')
-rw-r--r--testes/cstack.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/testes/cstack.lua b/testes/cstack.lua
index e3e14f74..4e37b988 100644
--- a/testes/cstack.lua
+++ b/testes/cstack.lua
@@ -105,6 +105,22 @@ do print("testing stack-overflow in recursive 'gsub'")
print("\tfinal count: ", count)
end
+do -- bug in 5.4.0
+ print("testing limits in coroutines inside deep calls")
+ count = 0
+ local lim = 1000
+ local function stack (n)
+ progress()
+ if n > 0 then return stack(n - 1) + 1
+ else coroutine.wrap(function ()
+ stack(lim)
+ end)()
+ end
+ end
+
+ print(xpcall(stack, function () return "ok" end, lim))
+end
+
do print("testing changes in C-stack limit")