Re: GSL function misbehaving on mipsel, possible compiler bug?

YunQiang Su <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <CAKcpw6WuUSQzKz=DucfGKRk7pPxPy0NOozmSZOzApN7pf1c0-w@mail.gmail.com>
Ed . <[email protected]> 于2022年2月16日周三 05:12写道:
>
> 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 who might know about GCC on MIPS.
>

Thank you for your feedback. I will try to find the real problem.

and let's CC debian-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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.