aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bootstraptest/test_flow.rb10
-rw-r--r--compile.c3
2 files changed, 12 insertions, 1 deletions
diff --git a/bootstraptest/test_flow.rb b/bootstraptest/test_flow.rb
index 0390062a24..9da6d45cbd 100644
--- a/bootstraptest/test_flow.rb
+++ b/bootstraptest/test_flow.rb
@@ -589,3 +589,13 @@ assert_equal "foo", %q{
end
Bug6460.new.m1
}, '[ruby-dev:46372]'
+
+assert_equal "foo", %q{
+ obj = "foo"
+ if obj || any1
+ any2 = any2
+ else
+ raise obj.inspect
+ end
+ obj
+}, '[ruby-core:87830]'
diff --git a/compile.c b/compile.c
index ea6b74d18d..139a778471 100644
--- a/compile.c
+++ b/compile.c
@@ -2730,7 +2730,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
ELEM_INSERT_NEXT(&dniobj->link, &pop->link);
goto again;
}
- else if ((piobj = (INSN *)get_prev_insn(iobj)) != 0 &&
+ else if (IS_INSN(iobj->link.prev) &&
+ (piobj = (INSN *)iobj->link.prev) &&
(IS_INSN_ID(piobj, branchif) ||
IS_INSN_ID(piobj, branchunless))) {
INSN *pdiobj = (INSN *)get_destination_insn(piobj);