Hi sage-devel,

It took me a while yesterday to figure out from where I was obtaining a 
Segmentation Fault in some cython code. I was using SIZE=200 thinking it 
was ok, but no, it is too large!

I am sharing this so that nobody else loses time on the same problem.

Sébastien

r"""
Segmentation Fault in Cython

EXAMPLES:

Segmentation fault on the machine at work::

    sage: test146()
    0
    0
    sage: test147()
    /usr/local/sage-5.3/spkg/bin/sage: line 335: 21280 Segmentation fault
    sage-ipython "$@" -i

Segmentation fault on my machine (32bit, maybe that's the reason) ::

    sage: test127()
    0
    0
    sage: test128()
    /Users/slabbe/Applications/bin/sage: line 136: 70473 Segmentation fault
    "$SAGE_ROOT/spkg/bin/sage" "$@"

"""
def test127():
    DEF SIZE = 127
    cdef int C[SIZE][SIZE][SIZE]
    c = C[1][2][2]

    print c
    int(c)
    D = {}; D[1] = c
    print C[1][2][5]

def test128():
    DEF SIZE = 128
    cdef int C[SIZE][SIZE][SIZE]
    c = C[1][2][2]

    print c
    int(c)
    D = {}; D[1] = c
    print C[1][2][5]

def test146():
    DEF SIZE = 146
    cdef int C[SIZE][SIZE][SIZE]
    c = C[1][2][2]

    print c
    int(c)
    D = {}; D[1] = c
    print C[1][2][5]

def test147():
    DEF SIZE = 147
    cdef int C[SIZE][SIZE][SIZE]
    c = C[1][2][2]

    # any of these lines may cause a segmentation fault
    #print c
    #int(c)
    D = {}; D[1] = c
    #print C[1][2][5]

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to