diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2024-09-02 02:56:18 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2024-09-02 02:56:18 -0700 |
| commit | 6a4e79533b4454392f3afdfa0c4d35b763b68466 (patch) | |
| tree | 23a27a800fbce80e01cba00f32da089f59fa3854 | |
| parent | e0e23e7d5eb4da42c490b1d3408bd6e5047e8f83 (diff) | |
merge revision(s) 1870505f478cc75993b296b7144a45137ace6937: [Backport #20651]
Fix wrong unreachable chunk remove when jump destination label is unremovable
| -rw-r--r-- | compile.c | 1 | ||||
| -rw-r--r-- | test/ruby/test_iseq.rb | 5 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 6 insertions, 2 deletions
@@ -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:} @@ -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" |
