Project

General

Profile

Actions

Bug #4029

closed

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

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

Status:
Rejected
Target version:
ruby -v:
ruby 1.9.2p0 (2010-08-18) [armv7l-linux-eabi]
Backport:
[ruby-core:33077]

Description

=begin
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 ;/* */
default:
rb_p(TYPE(RARRAY_PTR(args)[offset]));
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 = MyClass.new
WT = 0
win = File.new('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.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0