summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-20 15:28:33 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-20 15:28:33 +0000
commitadfe4f39304f330cebe673d603b226713ce58210 (patch)
tree23af854b44582f77905873d1de3611f46e635b0a
parent7c7a7c1205677e7b6e4814c7f314cb53816ab07c (diff)
* compile.c (NODE_NEXT, NODE_REDO): add dummy putnil instruction to
fix stack consistency error. [ruby-core:28172] * bootstraptest/test_jump.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--bootstraptest/test_jump.rb11
-rw-r--r--compile.c6
3 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 22eceac578f..bf2c52ddf24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Apr 21 00:26:17 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * compile.c (NODE_NEXT, NODE_REDO): add dummy putnil instruction to
+ fix stack consistency error. [ruby-core:28172]
+
+ * bootstraptest/test_jump.rb: add a test for above.
+
Wed Apr 21 00:16:44 2010 Yusuke Endoh <mame@tsg.ne.jp>
* ext/zlib/zlib.c (rb_deflate_params): update buf_filled count because
diff --git a/bootstraptest/test_jump.rb b/bootstraptest/test_jump.rb
index bfb380e45be..9484df88525 100644
--- a/bootstraptest/test_jump.rb
+++ b/bootstraptest/test_jump.rb
@@ -271,3 +271,14 @@ assert_normal_exit %q{
end
end.call
}
+
+assert_normal_exit %q{
+ while true
+ begin
+ raise
+ next
+ rescue
+ end
+ break
+ end
+}, '[ruby-core:28172]'
diff --git a/compile.c b/compile.c
index e96e34da5bc..f1a04feabae 100644
--- a/compile.c
+++ b/compile.c
@@ -3359,6 +3359,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_ADJUST(ret, nd_line(node), iseq->compile_data->redo_label);
ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
+ if (!poped) {
+ ADD_INSN(ret, nd_line(node), putnil);
+ }
}
else if (iseq->compile_data->end_label) {
LABEL *splabel = NEW_LABEL(0);
@@ -3424,6 +3427,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
add_ensure_iseq(ret, iseq, 0);
ADD_INSNL(ret, nd_line(node), jump, iseq->compile_data->redo_label);
ADD_ADJUST_RESTORE(ret, splabel);
+ if (!poped) {
+ ADD_INSN(ret, nd_line(node), putnil);
+ }
}
else if (iseq->type == ISEQ_TYPE_EVAL) {
redo_in_eval: