summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-09-02 02:56:18 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2024-09-02 02:56:18 -0700
commit6a4e79533b4454392f3afdfa0c4d35b763b68466 (patch)
tree23a27a800fbce80e01cba00f32da089f59fa3854
parente0e23e7d5eb4da42c490b1d3408bd6e5047e8f83 (diff)
merge revision(s) 1870505f478cc75993b296b7144a45137ace6937: [Backport #20651]
Fix wrong unreachable chunk remove when jump destination label is unremovable
-rw-r--r--compile.c1
-rw-r--r--test/ruby/test_iseq.rb5
-rw-r--r--version.h2
3 files changed, 6 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 4deb1c6396..e8fbb83b6f 100644
--- a/compile.c
+++ b/compile.c
@@ -2975,7 +2975,6 @@ remove_unreachable_chunk(rb_iseq_t *iseq, LINK_ELEMENT *i)
break;
}
else if ((lab = find_destination((INSN *)i)) != 0) {
- if (lab->unremovable) break;
unref_counts[lab->label_no]++;
}
}
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index e8c6382300..dc9ef17ffe 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -780,6 +780,11 @@ class TestISeq < Test::Unit::TestCase
end
def test_unreachable_pattern_matching
+ assert_in_out_err([], "true or 1 in 1")
+ assert_in_out_err([], "true or (case 1; in 1; 1; in 2; 2; end)")
+ end
+
+ def test_unreachable_pattern_matching_in_if_condition
assert_in_out_err([], "#{<<~"begin;"}\n#{<<~'end;'}", %w[1])
begin;
if true or {a: 0} in {a:}
diff --git a/version.h b/version.h
index 6021be3273..741c42c89f 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 95
+#define RUBY_PATCHLEVEL 96
#include "ruby/version.h"
#include "ruby/internal/abi.h"