summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorVladimir Dementyev <[email protected]>2021-01-19 00:00:52 +0300
committerNobuyoshi Nakada <[email protected]>2021-01-19 08:34:01 +0900
commit1b89b99941548fdb65305dd9a412082e7fdba45a (patch)
tree4102d063972f25d65807a257efdad73c4a8fb7bc /compile.c
parent9d1475c621af671494769dde5a09db4c86071474 (diff)
Mark pattern labels as unremoveable
Peephole optimization doesn't play well with find pattern at least. The only case when a pattern matching could have unreachable patterns is when we have lasgn/dasgn node, which shouldn't happen in real-life. Fixes https://bugs.ruby-lang.org/issues/17534
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 916efb505e..81ed8fd284 100644
--- a/compile.c
+++ b/compile.c
@@ -6408,11 +6408,11 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
int pat_line = nd_line(pattern);
LABEL *next_pat = NEW_LABEL(pat_line);
ADD_INSN (cond_seq, pat_line, dup);
-
// NOTE: set deconstructed_pos to the current cached value location
// (it's "under" the matchee value, so it's position is 2)
CHECK(iseq_compile_pattern_each(iseq, cond_seq, pattern, l1, next_pat, FALSE, 2));
ADD_LABEL(cond_seq, next_pat);
+ LABEL_UNREMOVABLE(next_pat);
}
else {
COMPILE_ERROR(ERROR_ARGS "unexpected node");