aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-08 04:13:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-08 04:13:51 +0000
commit4a3d8988ac2825db15242c5fc6a9e2cc912af8bc (patch)
treefabddaef86984680f9d983c80e70b4e8f22c8de8 /vm_insnhelper.c
parenta7060c4b8e1db596ae97c1fb309bc5488d3908fa (diff)
downloadruby-4a3d8988ac2825db15242c5fc6a9e2cc912af8bc.tar.gz
check break target correctly.
* compile.c (iseq_compile_each0): save target child_iseq in the catch-table for break. This iseq is not for continuation, but for search key at vm_throw_start(). * vm_insnhelper.c (vm_throw_start): check saved iseq first. * iseq.h: add comment for it. * test/ruby/test_iterator.rb (test_ljump): add a test for the issue: def call b; b.call; end call(Proc.new{break}){} #=> (1) should raise LocalJumpError call(Proc.new{break}) #=> (2) shoudd raies LocalJumpError, too. but (1) doesn't raise LocalJumpError. This issue is reported by Matz. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index e70cb646da..aee9b81927 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1090,7 +1090,9 @@ vm_throw_start(rb_thread_t *const th, rb_control_frame_t *const reg_cfp, enum ru
for (i=0; i<ct_size; i++) {
const struct iseq_catch_table_entry * const entry = &ct->entries[i];
- if (entry->type == CATCH_TYPE_BREAK && entry->start < epc && entry->end >= epc) {
+ if (entry->type == CATCH_TYPE_BREAK &&
+ entry->iseq == base_iseq &&
+ entry->start < epc && entry->end >= epc) {
if (entry->cont == epc) { /* found! */
is_orphan = 0;
}