Bug #2745
closed
iseq_set_sequence: adjust bug (next inside begin...rescue)
Added by murphy (Kornelius Kalnbach) almost 15 years ago.
Updated over 13 years ago.
Description
=begin
Input:
while true
begin
raise
next
rescue
end
break
end
Output:
-: [BUG] iseq_set_sequence: adjust bug
ruby 1.9.2dev (2010-02-14 trunk 26664) [i386-darwin10.2.0]
-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000be4 d:000be4 TOP
-- C level backtrace information -------------------------------------------
0 libruby19.1.9.1.dylib 0x00184ae5 rb_vm_bugreport + 229
1 libruby19.1.9.1.dylib 0x00040e3b report_bug + 379
2 libruby19.1.9.1.dylib 0x00040eec rb_bug + 44
3 libruby19.1.9.1.dylib 0x001578eb iseq_setup + 5179
4 libruby19.1.9.1.dylib 0x001635d7 rb_iseq_compile_node + 1607
5 libruby19.1.9.1.dylib 0x001698ff rb_iseq_new_with_bopt_and_opt + 159
6 libruby19.1.9.1.dylib 0x00169b6b rb_iseq_new_main + 107
7 libruby19.1.9.1.dylib 0x0010997e process_options + 2830
8 libruby19.1.9.1.dylib 0x00109c4b ruby_process_options + 155
9 libruby19.1.9.1.dylib 0x0004690f ruby_options + 127
10 ruby19 0x00001f17 main + 87
11 ruby19 0x00001e75 start + 53
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap
=end
Files
=begin
Note: It works without the "next".
=end
=begin
I'm sorry, the ruby -v is:
ruby 1.9.2dev (2010-02-14 trunk 26664) [i386-darwin10.2.0]
=end
- Assignee set to ko1 (Koichi Sasada)
- ruby -v changed from ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-darwin9.8.0] to ruby 1.9.2dev (2010-02-14 trunk 26664) [i386-darwin10.2.0]
=begin
The bug doesn't occur with attached patch.
=end
=begin
Yes, that solved it for me. Does this need to be backported to Ruby 1.9.1?
=end
- Assignee changed from ko1 (Koichi Sasada) to wanabe (_ wanabe)
=begin
Hi, wanabe
Ko1 agreed with your patch.
I also agree, but it would be better to insert dummy putnil
immediately after ADJUST_RESTORE.
diff --git a/compile.c b/compile.c
index e96e34d..f1a04fe 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:
--
Yusuke Endoh mame@tsg.ne.jp
=end
=begin
I also agree, but it would be better to insert dummy putnil
immediately after ADJUST_RESTORE.
I fully agree. Please commit your patch.
=end
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r27424.
Kornelius, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0