[Numpy-discussion] segmentation fault

Scott Ransom sransom at nrao.edu
Wed May 28 10:59:10 EDT 2008


Hmmm.  Interesting.  I'm on a 64-bit Debian Unstable system with numpy 
1.0.4 and python 2.5.2 and I don't get this:

In [1]: import numpy as np

In [2]: np.__version__
Out[2]: '1.0.4'

In [3]: def fn():
   ...:     x = np.random.rand(5,2)
   ...:     x.cumsum(None, out=x)
   ...:     return x
   ...:

In [4]: fn()
Out[4]:
array([[ 0.40329303,  0.45335328],
       [ 0.85664631,  0.84798294],
       [ 1.71329262,  0.05877989],
       [ 2.56127556,  0.99401291],
       [ 4.27456818,  0.79275409]])

Wonder if the 64-bit thing could be the difference?

Scott



On Wednesday 28 May 2008 10:53:22 am St?fan van der Walt wrote:
> 2008/5/28 Keith Goodman <kwgoodman at gmail.com>:
> > Does anyone else get this seg fault?
> >
> >>> def fn():
> >
> >    x = np.random.rand(5,2)
> >    x.cumsum(None, out=x)
> >    return x
> >
> >   ....:
> >>> fn()
> >
> > *** glibc detected *** /usr/bin/python: double free or corruption
> > (out): 0x08212dc8 ***
> >
> > I'm running 1.0.4 from Debian Lenny with python 2.5.2 compiled with
> > gcc 4.2.3-3, if that matters.
>
> Yeap, big bada-boom.  Well caught!
>
> ==28547== Source and destination overlap in memcpy(0x5B83198,
> 0x5B83198, 8) ==28547==    at 0x4C2508B: memcpy
> (mc_replace_strmem.c:402)
> ==28547==    by 0x60C2574: PyUFunc_GenericReduction
> (ufuncobject.c:2758) ==28547==    by 0x417E72: PyObject_Call
> (abstract.c:1861)
> ==28547==    by 0x5E5AD22: PyArray_GenericAccumulateFunction
> (arrayobject.c:3531)
> ==28547==    by 0x5E76031: PyArray_CumSum (multiarraymodule.c:991)
> ==28547==    by 0x5E7611C: array_cumsum (arraymethods.c:1533)
> ==28547==    by 0x417E72: PyObject_Call (abstract.c:1861)
> ==28547==    by 0x4860E9: PyEval_EvalFrameEx (ceval.c:3784)
> ==28547==    by 0x488B76: PyEval_EvalFrameEx (ceval.c:3659)
> ==28547==    by 0x48A375: PyEval_EvalCodeEx (ceval.c:2836)
>
> ==28547== Invalid write of size 8
> ==28547==    at 0x60B6362: DOUBLE_add (umathmodule.c.src:1019)
> ==28547==    by 0x60C25A3: PyUFunc_GenericReduction
> (ufuncobject.c:2762) ==28547==    by 0x417E72: PyObject_Call
> (abstract.c:1861)
> ==28547==    by 0x5E5AD22: PyArray_GenericAccumulateFunction
> (arrayobject.c:3531)
> ==28547==    by 0x5E76031: PyArray_CumSum (multiarraymodule.c:991)
> ==28547==    by 0x5E7611C: array_cumsum (arraymethods.c:1533)
> ==28547==    by 0x417E72: PyObject_Call (abstract.c:1861)
> ==28547==    by 0x4860E9: PyEval_EvalFrameEx (ceval.c:3784)
> ==28547==    by 0x488B76: PyEval_EvalFrameEx (ceval.c:3659)
> ==28547==    by 0x48A375: PyEval_EvalCodeEx (ceval.c:2836)
>
> Cheers
> St?fan
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion


-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989



More information about the NumPy-Discussion mailing list