summaryrefslogtreecommitdiff
path: root/bootstraptest/test_eval.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2023-12-21 16:01:16 -0800
committerJohn Hawthorn <john@hawthorn.email>2023-12-21 20:43:01 -0800
commitc18edc5b5d03b9abf355038a17956d69e0552228 (patch)
tree6db63e5c4fa1ef1e3f65ed04c72a3e1b40373a3a /bootstraptest/test_eval.rb
parentcae11dd8576d9ddb9bead2e5340677c5d05b03f5 (diff)
Avoid underflow of rb_yjit_live_iseq_count
This value is only incremented when rb_iseq_translate_threaded_code is called, which doesn't happen for iseqs which result in a syntax error. This is easy to hit by running a debug build with RUBY_FREE_AT_EXIT=1, but any build and options could underflow this value by running enough evals.
Diffstat (limited to 'bootstraptest/test_eval.rb')
-rw-r--r--bootstraptest/test_eval.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/bootstraptest/test_eval.rb b/bootstraptest/test_eval.rb
index a9f389c673..47e2924846 100644
--- a/bootstraptest/test_eval.rb
+++ b/bootstraptest/test_eval.rb
@@ -227,6 +227,16 @@ assert_equal %q{[10, main]}, %q{
}, '[ruby-dev:31372]'
end
+assert_normal_exit %{
+ $stderr = STDOUT
+ 5000.times do
+ begin
+ eval "0 rescue break"
+ rescue SyntaxError
+ end
+ end
+}
+
assert_normal_exit %q{
$stderr = STDOUT
class Foo