[SciPy-dev] Illegal instruction in ndimage test

Matthew Brett matthew.brett@gmail....
Thu Oct 18 19:24:37 CDT 2007


Hi,

> > gcc: scipy/ndimage/src/ni_filters.c
> > gcc: scipy/ndimage/src/nd_image.c
> > scipy/ndimage/src/nd_image.c: In function 'Py_Filter1DFunc':
> > scipy/ndimage/src/nd_image.c:273: warning: function called through a
> > non-compatible type
> > scipy/ndimage/src/nd_image.c:273: note: if this code is reached, the program
> > will abort

Hmm - well - this is beyond my rudimentary C, and I'd be very grateful
for any help from a C person here, but:

The problem seems to be this set of lines in nd_image.h (starting line 276):

#define  NA_OutputArray (*(PyArrayObject* (*)
(PyObject*,NumarrayType,int) ) (void *) NA_OutputArray)
#define  NA_IoArray (*(PyArrayObject* (*) (PyObject*,NumarrayType,int)
) (void *) NA_IoArray)
#define  NA_NewArray (*(PyArrayObject* (*) (void* buffer,
NumarrayType, int, ...) ) (void *) NA_NewArray )
#define  NA_elements (*(unsigned long (*) (PyArrayObject*) ) (void *)
NA_elements)
#define  NA_InputArray (*(PyArrayObject* (*)
(PyObject*,NumarrayType,int) ) (void *) NA_InputArray)

Commenting out these lines allows the code to compile and the ndimage
tests to pass.  For the offending lines in nd_image.c, (line 273 for
example above), the C preprocessor generates this kind of thing:

py_ibuffer = (*(PyArrayObject* (*) (void* buffer, NumarrayType, int,
...) ) (void *) NA_NewArray )(iline, NPY_DOUBLE, 1, &ilen);

Now, I've no idea what the #define lines are for (it is late, but
that's not the reason).  Can anyone enlighten me?

Matthew.


More information about the Scipy-dev mailing list