[SciPy-Dev] Debugging a segfault

Andrew Nelson andyfaff at gmail.com
Wed Sep 13 23:59:16 EDT 2017


I tried using all your suggestions Pauli, but didn't get anymore
information (probably user error, I'm new to this). So I resorted to doing
the test in a Python interpreter:

Python 3.6.2 (default, Sep  8 2017, 16:44:49)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from scipy.io import FortranFile, _test_fortran
>>> filename = 'test.dat'
>>> m, n, k = 5, 3, 2
>>> a = np.random.randn(m, n, k)
>>> with FortranFile(filename, 'w') as f:
...     f.write_record(a.T)
>>>
>>> a2 = _test_fortran.read_unformatted_double(m, n, k, filename)
At line 7 of file scipy/io/_test_fortran.f
Fortran runtime error: Invalid argument

So line 129 in test_fortran.py crashes the interpreter. Line 130 doesn't
crash. Lines 135-144 don't crash.

Line 152 also crashes the interpreter:

>>> a2, b2 = _test_fortran.read_unformatted_mixed(m, n, k, filename)
At line 28 of file scipy/io/_test_fortran.f
Fortran runtime error: Invalid argument

I'm taking a stab at something, but line 7 and line 28 of _test_fortran.f
both refer to reading doubles. Presumably unformatted doubles in this test
(as you suggested). However, I checked that scipy was compiled against
gfortran, I've also checked that numpy was compiled with gfortran.

A.



On 13 September 2017 at 20:16, Pauli Virtanen <pav at iki.fi> wrote:

> Andrew Nelson kirjoitti 13.09.2017 klo 04:04:
> [clip]
>
>> I also tried running the tests in gdb, using the instructions that were
>> provided, but that didn't give me a stack trace either.
>>
>
> You need to compile it with debug symbols enabled, `rm -rf build;
> runtest.py -g ...`
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>



-- 
_____________________________________
Dr. Andrew Nelson


_____________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20170914/67c20a1c/attachment.html>


More information about the SciPy-Dev mailing list