Project

General

Profile

Bug #13578

Another iseq_set_sequence: adjust bug

Added by zenspider (Ryan Davis) almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
2.4.1p111
[ruby-core:81272]

Description

This seems to be related to #12613

#!/usr/bin/env ruby -w

def process_defn
  if true then
    # nothing needed here
  else
    if true then
      case 42
      when 42 then
        return 42 # BOOM
      when s { 42 } then
        # nothing needed here
      end
    end
  end

  return 42
end

causes:

wtf.rb:10: [BUG] iseq_set_sequence: adjust bug -2 < 0
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

I just built and installed 2.4.1 and it is still there. Also repros in 2.4.0. 2.3 and below seem fine.

Associated revisions

Revision 58810
Added by nobu (Nobuyoshi Nakada) almost 2 years ago

compile.c: fix catch-table labels optimization

  • compile.c (remove_unreachable_chunk): do not eliminate chunks followed by labels in catch-table entries.

Revision 5cf36324
Added by nagachika (Tomoyuki Chikanaga) over 1 year ago

merge revision(s) 58810,58894: [Backport #13578]

compile.c: fix catch-table labels optimization

* compile.c (remove_unreachable_chunk): do not eliminate chunks
  followed by labels in catch-table entries.
compile.c: fix possible use of uninitialized value

LABEL::unremovable added by r58810 is not initialized by
new_label_body(), making the optimization unstable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 59514
Added by nagachika (Tomoyuki Chikanaga) over 1 year ago

merge revision(s) 58810,58894: [Backport #13578]

compile.c: fix catch-table labels optimization

* compile.c (remove_unreachable_chunk): do not eliminate chunks
  followed by labels in catch-table entries.
compile.c: fix possible use of uninitialized value

LABEL::unremovable added by r58810 is not initialized by
new_label_body(), making the optimization unstable.

History

Updated by zenspider (Ryan Davis) almost 2 years ago

Further reduced via IRC:

def process_defn
  if false
    case 42
    when s {} then
    when 42 then
      return
    end
  end
  return
end
#2

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

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

Updated by zenspider (Ryan Davis) almost 2 years ago

Thank you. While your test code does NOT repro under 2.4.1p111, it does under trunk. I've verified that this and my original code all compile fine under latest trunk.

Updated by nagachika (Tomoyuki Chikanaga) over 1 year 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 r59514 merged revision(s) 58810,58894.

Also available in: Atom PDF