Project

General

Profile

Actions

Bug #2745

closed

iseq_set_sequence: adjust bug (next inside begin...rescue)

Added by murphy (Kornelius Kalnbach) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2010-02-14 trunk 26664) [i386-darwin10.2.0]
Backport:
[ruby-core:28172]

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

adjust_sp.patch (976 Bytes) adjust_sp.patch wanabe (_ wanabe), 02/21/2010 04:28 PM
Actions #1

Updated by murphy (Kornelius Kalnbach) about 14 years ago

=begin
Note: It works without the "next".
=end

Actions #2

Updated by murphy (Kornelius Kalnbach) about 14 years ago

=begin
I'm sorry, the ruby -v is:
ruby 1.9.2dev (2010-02-14 trunk 26664) [i386-darwin10.2.0]
=end

Actions #3

Updated by wanabe (_ wanabe) about 14 years ago

  • 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

=end

Actions #4

Updated by wanabe (_ wanabe) about 14 years ago

=begin
The bug doesn't occur with attached patch.
=end

Actions #5

Updated by murphy (Kornelius Kalnbach) about 14 years ago

=begin
Yes, that solved it for me. Does this need to be backported to Ruby 1.9.1?
=end

Actions #6

Updated by mame (Yusuke Endoh) almost 14 years ago

  • 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
=end

Actions #7

Updated by wanabe (_ wanabe) almost 14 years ago

=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

Actions #8

Updated by mame (Yusuke Endoh) almost 14 years ago

  • 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0