Dear Sage support,

since a couple of hours I am fighting with a segmentation fault in a
Cython module. Can you help me?

I can boil it down to the following files:

1. Ccrash.h:
typedef unsigned char FEL;
typedef FEL *PTR;
typedef struct
{
  long i;
  long m;
} piv_t;
piv_t *_zfindpiv_(PTR row);


2. Ccrash.c:
#include "Ccrash.h"
piv_t *_zfindpiv_(PTR row)
{
        piv_t *P;
        P->i=0;
        P->m=0;
        return P;
}


3. Crash.pxd:
cdef extern from "Ccrash.h":
    ctypedef unsigned char FEL
    ctypedef FEL *PTR
    ctypedef struct piv_t:
        long i
        long m
    piv_t *_zfindpiv_(PTR row)


4. Crash.pyx:
def test():
    cdef PTR row
    print "Start"
    cdef piv_t *P = _zfindpiv_(row)
    print "Values", P.i, P.m
    return (P.i,P.m)


I made a Crash.so, precisely:
> sage -cython Crash.pyx
> gcc -c -fPIC -I/home/king/SAGE/devel/sage-3.1.4/local/include/python2.5/ 
> Crash.c -o Crash.o
> gcc -shared Crash.o Ccrash.o -o Crash.so

I tried it with sage -gdb, but I need help for understanding its
output:

sage: from Crash import test
Error while mapping shared library sections:
./Crash.so: Datei oder Verzeichnis nicht gefunden.
Error while reading shared library symbols:
./Crash.so: Datei oder Verzeichnis nicht gefunden.

## Very strange, because ./Crash.so is present and is used in the next
line

sage: test()
Start
Values 0 0
(0, 0)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47137655676112 (LWP 6674)]
0x00000000004d0090 in frame_dealloc (f=0x3b04d00)
    at Objects/frameobject.c:424
424     Objects/frameobject.c: Datei oder Verzeichnis nicht gefunden.
        in Objects/frameobject.c


So, apparently the segmentation fault occurs *after* the values are
returned by test().
What has happened? Is Cython unable to deallocate P or row properly??

Thanks in advance for your help
      Simon

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to