From: shugo@... Date: 2016-07-11T01:28:58+00:00 Subject: [ruby-core:76343] [Ruby trunk Bug#12576] SEGV when interrupting tail recursion Issue #12576 has been updated by Shugo Maeda. Shugo Maeda wrote: > The following patch seems to fix the problem, but I'm not sure. > Could you check it, ko1? > > ```diff > diff --git a/compile.c b/compile.c > index 33e0ba3..c2a710a 100644 > --- a/compile.c > +++ b/compile.c > @@ -2415,6 +2415,8 @@ static inline int > tailcallable_p(rb_iseq_t *iseq) > { > switch (iseq->body->type) { > + case ISEQ_TYPE_EVAL: > + /* eval can't tail call because cfp will be over popped */ > case ISEQ_TYPE_RESCUE: > case ISEQ_TYPE_ENSURE: > /* rescue block can't tail call because of errinfo */ > ``` load and main have the same problem, so ISEQ_TYPE_TOP and ISEQ_TYPE_MAIN should be added. ---------------------------------------- Bug #12576: SEGV when interrupting tail recursion https://bugs.ruby-lang.org/issues/12576#change-59584 * Author: Shugo Maeda * Status: Assigned * Priority: Normal * Assignee: Koichi Sasada * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- The following program causes SEGV when interrupted by SIGINT. ```ruby RubyVM::InstructionSequence.compile_option = { :tailcall_optimization => true, :trace_instruction => false } eval <