Project

General

Profile

Actions

Bug #13682

closed

return inside of ensure causes [BUG]

Bug #13682: return inside of ensure causes [BUG]

Added by shyouhei (Shyouhei Urabe) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-06-27 trunk 59146) [x86_64-darwin15]
[ruby-core:81777]

Description

Attached script causes [BUG] Stack consistency error (sp: 7, bp: 6)


Files

bug.rb (36 Bytes) bug.rb shyouhei (Shyouhei Urabe), 06/27/2017 04:02 AM

Related issues 1 (0 open1 closed)

Updated by nobu (Nobuyoshi Nakada) over 8 years ago Actions #1

  • 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 #13682]

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

Updated by shyouhei (Shyouhei Urabe) over 8 years ago Actions #2 [ruby-core:81786]

  • 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) over 8 years ago Actions #3

  • 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 #13682]

Updated by usa (Usaku NAKAMURA) over 8 years ago Actions #4

  • 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) over 8 years ago Actions #5

Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago Actions #6 [ruby-core:82232]

  • 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: PDF Atom