New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CArray cannot allocate contiguous memory #5828
Comments
From @titsukiSee the following codes and results: *** codes *** * t/05-pointer.c #include <stdio.h> #ifdef _WIN32 double dot(struct Feature* lhs, struct Feature* rhs) { while(lhs->index != -1 && rhs->index != -1) { *t/05-pointer.h #if ! defined(HEADER_POINTER_H) #ifdef __cplusplus struct Feature { double dot(struct Feature*, struct Feature*); #ifdef __cplusplus #endif /* HEADER_POINTER_H */ * t/CompileTestLib.pm unit module CompileTestLib; my @cleanup; # files to be cleaned up afterwards sub compile_test_lib($name) is export { # MoarVM exposes exposes GNU make directives here, but we cannot pass this to gcc directly. $c_line = "$cfg<cc> -c $cfg<ccshared> $cfg<ccout>$name$o $cfg<cflags> t/$name.c"; sub compile_cpp_test_lib($name) is export { my (@fails, $succeeded); END { * t/05-pointer.t use v6; compile_test_lib('05-pointer'); class Feature is repr('CStruct') { my sub dot(Feature, Feature) returns num64 is native("./05-pointer") { * } my CArray[Feature] $lhs .= new; for 1..5 -> $index { for ^5 { is dot($lhs[0], $rhs[0]), [+] ((2.5 * 2.5) xx 5); done-testing; *** results *** $ mi6 test -v t/05-pointer.t # Failed test at t/05-pointer.t line 33 Test Summary Report t/05-pointer.t (Wstat: 256 Tests: 21 Failed: 1) In the above example, dot method accepts entry address of given two vectors and computes the dot product of the values they have. However, in fact, it returns 6.25e0. (I faced this type of error while creating a libsvm bindings for Perl 6: https://github.com/cjlin1/libsvm/blob/master/svm.cpp#L294-L314 ) $ perl6 --version |
Migrated from rt.perl.org#130187 (status was 'new')
Searchable as RT130187$
The text was updated successfully, but these errors were encountered: