Actions
Bug #12613
closediseq_set_sequence: adjust bug -1 < 0 (retry inside begin/rescue)
Description
Code:
while true
begin
p "loop"
raise
rescue
p "Risen"
retry
else
retry
end
break
end
Output:
[BUG] iseq_set_sequence: adjust bug -1 < 0
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 E:0021a0 (none) [FINISH]
-- C level backtrace information -------------------------------------------
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(rb_vm_bugreport+0xc29) [0x7f5d33138689] vm_dump.c:688
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(rb_compile_bug_str+0xae) [0x7f5d32fc963e] error.c:497
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(iseq_setup+0x142b) [0x7f5d3310dadb] compile.c:1801
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(rb_iseq_compile_node+0x146) [0x7f5d3310e0b6] compile.c:654
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(rb_iseq_new_with_opt+0x94) [0x7f5d33117724] iseq.c:474
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(rb_iseq_new_main+0x5a) [0x7f5d33117a6a] iseq.c:445
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(process_options+0x8e5) [0x7f5d330a5375] ruby.c:1612
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(ruby_process_options+0xe8) [0x7f5d330a5aa8] ruby.c:2093
/home/jonny/.rvm/rubies/ruby-2.3.1/lib/libruby.so.2.3(ruby_options+0xb7) [0x7f5d32fd3807] eval.c:103
/home/jonny/.rvm/rubies/ruby-2.3.1/bin/ruby(main+0x43) [0x4008c3] main.c:36
-- Other runtime information -----------------------------------------------
(Lots of info removed here)
[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
Files
Updated by dioni21 (Joao Carlos Mendes Luis) over 8 years ago
If I change the second "retry" for "redo", it works...
If I remove the surrounding while loop, this error is raised:
Invalid retry (SyntaxError)
Updated by ko1 (Koichi Sasada) over 8 years ago
- Assignee set to ko1 (Koichi Sasada)
Updated by bkutil (Balazs Kutil) almost 8 years ago
- File ruby_2.4.0.crash ruby_2.4.0.crash added
This code has the same symptoms. Removing the second begin/rescue, the method, or the return statement makes the code work (reports SyntaxError, without crashing).
#!/usr/bin/env ruby
def test
begin
break
rescue
# NOOP
end
return if true
begin
# Test
rescue
# NOOP
end
end
Error:
[BUG] iseq_set_sequence: adjust bug -1 < 0)
On versions:
- ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
- ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
Rubies 2.2.4 and earlier also warn about invalid break, before crashing.
- ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin16]
- ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-darwin16.0]
- ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin16.3.0]
./break_fail.rb:5: Invalid break
./break_fail.rb: [BUG] iseq_set_sequence: adjust bug
Updated by nobu (Nobuyoshi Nakada) almost 8 years ago
- Status changed from Open to Closed
Applied in changeset r57300.
compile.c: check compile
- compile.c (iseq_compile_each): check if sub nodes succeeded.
[ruby-core:76531] [Bug #12613]
Updated by nagachika (Tomoyuki Chikanaga) almost 8 years ago
- Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED
Updated by nobu (Nobuyoshi Nakada) almost 8 years ago
- Description updated (diff)
- Backport changed from 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED
r57368 would be better, to backport at least.
Updated by nagachika (Tomoyuki Chikanaga) almost 8 years ago
- Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE, 2.4: REQUIRED
ruby_2_3 r57572 merged revision(s) 57368.
Updated by naruse (Yui NARUSE) over 7 years ago
- Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE, 2.4: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE, 2.4: DONE
ruby_2_4 r57854 merged revision(s) 57300,57368.
Updated by usa (Usaku NAKAMURA) over 7 years ago
- Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE, 2.4: DONE to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE, 2.4: DONE
ruby_2_2 r58090 merged revision(s) 57368.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0