diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-01 12:02:17 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-01 12:02:17 +0000 |
commit | 0628973435abeccf676f3c2563579b3dbab06976 (patch) | |
tree | 77ca67418c82d0adb8a8a2212bf4c00cbd44eb65 /bootstraptest | |
parent | bf0dcd5b855e7798b343bbe669f36e98afaf86e1 (diff) |
merge revision(s) 63868,63870: [Backport #14897]
Fix a bug of peephole optimization
```
if L1
L0:
jump L2
L1:
...
L2:
```
was wrongly optimized to:
```
unless L2
L0:
L1:
...
L2:
```
To make it conservative, this optimization is now disabled when there is
any label between `if` and `jump` instructions.
Fixes [Bug #14897].
compile.c: remove unreachable jump only
* compile.c (iseq_peephole_optimize): remove unreachable jump
instruction only. if it is labeled and referred from other
instructions, it is reachable and must not be removed.
[ruby-core:87830] [Bug #14897]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_flow.rb | 10 |
1 files changed, 10 insertions, 0 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]' |