Hi,
I’m a brand-new Debian-perl packaging person, trying to figure out why PDL (Perl Data Language)’s binding for gsl_linalg_complex_LU_det (only) is behaving weirdly, on mipsel. sebastic (Cc:ed just for his awareness) suggested you when I asked whomight know about GCC on MIPS.
Here is what is seen when having done “apt source pdl” in a chroot on eller, then these commands:
vi Libtmp/GSL/LINALG/Makefile.PL # remove the paragraph disabling the build on MIPS
perl Makefile.PL
make test # it fails with a SIGBUS
gdb (cd Libtmp/GSL/LINALG; make && gdb perl -ex "run -Mblib t/gsl_linalg.t") shows:
0x77454b7c in gsl_linalg_complex_LU_det (LU=0xffffffff, signum=0) at luc.c:501
This is my attempt at a short repro case, which in fact works fine:
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_complex_math.h>
#define MATRIX_SETUP(m, rows, cols, lda, datap) \
m.size1 = rows; \
m.size2 = cols; \
m.tda = lda; \
m.data = (double *)datap; \
m.owner = 0;
int main(char **argv, int argc) {
gsl_matrix_complex m;
gsl_complex cmplx_data[] = {
gsl_complex_rect(0.51, 1e-09),
gsl_complex_rect(0.13, 1e-09),
gsl_complex_rect(0.19, 1e-09),
gsl_complex_rect(0.85, 1e-09),
gsl_complex_rect(0.352941176470588, 1.26874279123414e-09),
gsl_complex_rect(0.554117647058823, 4.82122260668974e-10),
gsl_complex_rect(0.502941176470588, 4.05997693194925e-10),
gsl_complex_rect(0.66, -4.31372549019608e-10),
gsl_complex_rect(0.803921568627451, 3.84467512495194e-10),
gsl_complex_rect(0.244515215852795, 5.0912340119475e-11),
gsl_complex_rect(0.71427813163482, -1.84892182539146e-12),
gsl_complex_rect(-0.264713375796178, -5.88439467907196e-11),
gsl_complex_rect(0.274509803921569, 1.42252979623222e-09),
gsl_complex_rect(0.476999292285916, 5.60511557577023e-10),
gsl_complex_rect(0.949126848480345, -2.60410581725936e-11),
gsl_complex_rect(0.363093705877982, -5.98876404774416e-10)
};
MATRIX_SETUP(m, 4, 4, 4, cmplx_data)
gsl_complex z = gsl_linalg_complex_LU_det(&m, -1);
printf("ret=%.6g%+.6g\n", GSL_REAL(z), GSL_IMAG(z));
return 0;
}
The previous stack frame, from which gsl_linalg_complex_LU_det is called, shows &m with a sensible value. It behaves the same if I set -O0 rather than the -O2 in the Makefile.
I’m wondering if you have any insight into what’s happening? The symptoms suggest either a compiler bug or something is smashing the stack. Similar behaviour happens on PPC64 and Sparc64 which is why the disabling code also looks for those. gsl_linalg_complex_LU_det is quite an unremarkable function, only about 5 lines with one loop.
Best regards,
Ed
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 430 |
Nodes: | 16 (2 / 14) |
Uptime: | 155:59:51 |
Calls: | 9,068 |
Calls today: | 5 |
Files: | 13,402 |
Messages: | 6,020,574 |