Bug #4029


Stack consistency error (sp: 7, bp: 8) using external libs

Added by catswhiskers (Andrew Senior) over 11 years ago. Updated about 11 years ago.

Target version:
ruby -v:
ruby 1.9.2p0 (2010-08-18) [armv7l-linux-eabi]


cat example_ext.c

#include "ruby.h"
VALUE cMyClass;

static VALUE
my_func( VALUE receiver, VALUE args )
int offset;
for (offset = 0; offset < 6; offset ++)
switch (TYPE(RARRAY_PTR(args)[offset])) {
case T_STRING:
printf("Arg reads %s\n", RSTRING_PTR(RARRAY_PTR(args)[offset]));
break ;
case T_DATA:
printf("Data \n");
break ;
case T_SYMBOL:
printf("Symbol \n");
break ;
case T_ARRAY:
printf("Array \n");
break ;
case T_HASH:
printf("Hash \n");
break ;
case T_OBJECT:
printf("Object \n");
break ;
case T_NIL:
printf("Nil \n");
break ;
case T_FIXNUM:
printf("Fnum \n");
break ;
case T_BIGNUM:
printf("Bnum \n");
break ;
case T_CLASS:
printf("Class \n");
break ;/* */
printf("index %d\n", offset);
} static VALUE my_init( VALUE self )
return self;

VALUE cMyClass;
void Init_example_ext(void)
cMyClass = rb_define_class("MyClass", rb_cObject);
rb_define_method(cMyClass, "initialize", my_init, 0);
rb_define_method(cMyClass, "my_meth", my_func, -2);

cat probe.rb
require 'example_ext'
x =
WT = 0
win ='test/proto.rb')
x.my_meth( nil, win, [], "sept", WT, x ) <<<<<<<< OK
x.my_meth( nil, win, [], "sept", x, WT ) <<<<<<<< BUT
probe.rb:6: [BUG] Stack consistency error (sp: 7, bp: 8)
ruby 1.9.2p0 (2010-08-18) [armv7l-linux-eabi]

-- control frame ----------
c:0003 p:0113 s:0007 b:0008 l:000244 d:001214 EVAL probe.rb:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000244 d:000244 TOP

-- Ruby level backtrace information ----------------------------------------
probe.rb:6:in `'

-- C level backtrace information -------------------------------------------

Not had time to test this in x86 systems. Tried with ruby 1.9.2p0 (2010-08-18) and latest
stable tarball.

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Open to Feedback

I can't reproduce it with 1.9.2p430 and trunk on x86 darwin and linux, regardless fix of a bug that my_func() returns indefinite value.

Updated by naruse (Yui NARUSE) about 11 years ago

  • Status changed from Feedback to Assigned
  • Assignee set to ko1 (Koichi Sasada)

Do you have any information?

Actions #3

Updated by nahi (Hiroshi Nakamura) about 11 years ago

  • Target version changed from 1.9.2 to 1.9.3

Updated by ko1 (Koichi Sasada) about 11 years ago

  • Status changed from Assigned to Rejected

Is it reproducible? If so, we'll reopen it.


Also available in: Atom PDF