Project

General

Profile

Actions

Bug #13682

closed

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r59183.


fix return in toplevel rescue/ensure

  • compile.c (iseq_compile_each0): throw TAG_RETURN at return in
    toplevel rescue/ensure to adjust VM stack properly.
    [ruby-core:81777] [Bug ]

  • vm_insnhelper.c (vm_throw_start): allow return in toplevel
    rescue/ensure.

Updated by shyouhei (Shyouhei Urabe) almost 8 years ago

  • Status changed from Closed to Open

Seems incomplete.

% ./miniruby -ve 'begin raise ensure return end and self'
ruby 2.5.0dev (2017-06-27 trunk 59183) [x86_64-darwin15]
-- raw disasm--------
 [none]
 0000 trace                1                                           (   1)
 <L001>
 0002 putself                                                          (   1)
 0003 opt_send_without_block <callinfo:raise, 0>, <call cache>         (   1)
 0006 pop                                                              (   1)
 <L002>
 adjust: [label: -1]
 0007 putnil                                                           (   1)
 0008 leave                                                            (   1)
 <L003>
 0009 pop                                                              (   1)
 0010 dup                                                              (   1)
 0011 branchunless         <L000>                                      (   1)
*0013 pop                                                              (   1)
 0014 putself                                                          (   1)
 <L000>
 0015 leave                                                            (   1)
---------------------
-e:1: argument stack underflow (-1)
Traceback (most recent call last):
-e: compile error (SyntaxError)
[1]    48279 exit 1     ./miniruby -ve 'begin raise ensure return end and self'

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r59184.


fix return in toplevel ensure

  • compile.c (iseq_compile_each0): adjust stack after return in
    toplevel ensure, when the value is used.
    [ruby-core:81777] [Bug ]

Updated by usa (Usaku NAKAMURA) almost 8 years ago

  • Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Related to : Allow returning from require added

Updated by nagachika (Tomoyuki Chikanaga) almost 8 years ago

  • Backport changed from 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE

ruby_2_4 r59493 merged revision(s) 59183,59184.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0