Simon King wrote: > 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; > }
It looks like you are never allocating the actual piv_t struct that P is supposed to point to. You are just creating the pointer P and then assigning directly to it. Shouldn't you have something like piv_t *P = malloc(sizeof(piv_t)); You'll also probably want to be careful about deallocating that memory sometime to prevent a leak. Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---