Bug #1967: Segmentation fault at test_qsort1 and test_qsort2 in
test/dl/test_func.rb running on sparc-solaris-2.10
http://redmine.ruby-lang.org/issues/show/1967
e$B5/I<<Te(B: Naohisa G.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-08-19) [sparc-solaris2.10]
sparc-solaris-2.10 e$B$Ge(B 64e$B%S%C%H%3%s%Q%$%k$7$?>l9g!"e(B
make check e$B$,e(B test/dl/test_func.rb e$B$Ne(B test_qsort1 e$B$K$Fe(B
Segmentation fault e$B$K$J$j$^$9!#e(B
e$B860x$O!"0z?t$N7?$G$7$?!#e(B
void qsort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void ));
e$B$Ne(B size_t e$B7?$N0z?te(B nmenb e$B$$h$Se(B size e$B$KBP$7$Fe(B
TYPE_INT e$B$,;XDj$5$l$F$$$^$9$,!"e(B
size_t e$B$Oe(B 64e$B%S%C%H4D6-$G$Oe(B unsigned long
e$B$K$J$k$?$a!“FC$Ke(Bsparc v9 e$B$N$h$&$Je(B
e$B%S%C%0%(%s%G%#%”%s$N4D6-$G$O0[>o$J?tCM$,e(B qsort
e$B$N0z?t$KEO$k$N$,860x$G$7$?!#e(B
TYPE_INT e$B$re(B TYPE_LONG e$B$KJQ99$7$?0J2<$N%Q%C%A$GD>$j$^$7$?!#e(B
(TYPE_SIZE_T e$B$OB8:_$7$J$$!)e(B)
Index: test/dl/test_func.rb
— test/dl/test_func.rb (revision 24582)
+++ test/dl/test_func.rb (working copy)
@@ -43,7 +43,7 @@
cb = Function.new(CFunc.new(0, TYPE_INT, ‘qsort’),
[TYPE_VOIDP, TYPE_VOIDP]){|x,y| CPtr.new(x)[0]
<=> CPtr.new(y)[0]}
qsort = Function.new(CFunc.new(@libc[‘qsort’], TYPE_VOID,
‘qsort’),
-
[TYPE_VOIDP, TYPE_INT, TYPE_INT,
TYPE_VOIDP])
-
[TYPE_VOIDP, TYPE_LONG, TYPE_LONG,
TYPE_VOIDP])
buff = “9341”
qsort.call(buff, buff.size, 1, cb)
assert_equal(“1349”, buff)
@@ -53,7 +53,7 @@
cb = TempFunction.new(CFunc.new(0, TYPE_INT, ‘qsort’),
[TYPE_VOIDP, TYPE_VOIDP])
qsort = Function.new(CFunc.new(@libc[‘qsort’], TYPE_VOID,
‘qsort’),
-
[TYPE_VOIDP, TYPE_INT, TYPE_INT,
TYPE_VOIDP])
-
[TYPE_VOIDP, TYPE_LONG, TYPE_LONG,
TYPE_VOIDP])
buff = “9341”
qsort.call(buff, buff.size, 1, cb){|x,y| CPtr.new(x)[0] <=>
CPtr.new(y)[0]}
assert_equal(“1349”, buff)