Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: MEX compilation: warning and segmentation fault
Posted:
Feb 4, 2013 10:14 AM
|
|
"James Tursa" wrote in message <kegpq4$ish$1@newscl01ah.mathworks.com>... > "Alle Meije " <a.m.wink@gmail.com> wrote in message <kegeak$20c$1@newscl01ah.mathworks.com>... > > > > This code worked without problems in older matlab versions, and other matlab functions depend on it. > > > > Now however, when I compile it now, there is first a warning message > > >> mex fisidwt.c polyphase.c % message about different gcc version > > >> mex fsidwt.c polyphase.c % message about different gcc version > > fsidwt.c: In function ?multiMRFWD1D?: > > fsidwt.c:187: warning: cast to pointer from integer of different size > > fsidwt.c:188: warning: cast to pointer from integer of different size > > fsidwt.c:189: warning: cast to pointer from integer of different size > > fsidwt.c:190: warning: cast to pointer from integer of different size > > which is weird because no integers are cast to pointers. But it's only a warning, so let's carry on. > > Maybe you don't think any integers are being cast to pointers, but the compiler certainly does. What do those lines look like? > > James Tursa
Ah, the lines are in the code in the zipfile at http://ubuntuone.com/6zXIIuA3J4OTTlSquycMlz -- and then line numbers 187-190 of fsidwt.c.
Those lines read: Hfilter2d=(dComplexMat)dComplexMake2D(hcomp[0],NQ,Q); Gfilter2d=(dComplexMat)dComplexMake2D(hcomp[1],NQ,Q); Detail2d=(dComplexMat)dComplexMake2D(workspaced,Q,NQ); Approx2d=(dComplexMat)dComplexMake2D(workspacec,Q,NQ);
All the LHS are of type dComplexMat which is typedef struct {double r,i;} dComplex; typedef dComplex *dComplexVec; typedef dComplexVec *dComplexMat; All the RHS are of type (dComplexVec, long, long) and the code of dComplexMake2D() is:
dComplexMat dComplexMake2D( dComplexVec array1D, int width, int height) { register int i; dComplexMat theMatrix= (dComplexMat)mxCalloc(width,sizeof(dComplexVec)); theMatrix[0]=(dComplexVec)array1D; for(i=1;i<width;i++) theMatrix[i] = theMatrix[i-1] + height; return theMatrix; }
turning a vector of complex numbers into a matrix. The only 'int's in that routine are for the matrix width and height, but they are not converted to pointers???
If the compiler 'thinks' they should be, I would very much like to know how that works...
With best wishes, Alle Meije
|
|
|
|