The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: mex warning and crash
Replies: 1   Last Post: Jun 5, 2012 11:23 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alle Mejie

Posts: 12
Registered: 2/24/11
mex warning and crash
Posted: Jun 5, 2012 4:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi -

I had dusted off some really old mex code (previously used on 32-bit systems) in the hope of compiling it for the latest matlab release (on a 64-bit system). The code (mainly wavelet routines) features lines such as

186: Hfilter2d=(dComplexMat)dComplexMake2D(hcomp[0],NQ,Q);
187: Gfilter2d=(dComplexMat)dComplexMake2D(hcomp[1],NQ,Q);
188: Detail2d=(dComplexMat)dComplexMake2D(workspaced,Q,NQ);
189: Approx2d=(dComplexMat)dComplexMake2D(workspacec,Q,NQ);


typedef struct {double r,i;} dComplex;
typedef dComplex *dComplexVec;
typedef dComplex **dComplexMat;


dComplexMat dComplexMake2D(dComplexVec array1D,
int width, int height) {
register int i;
dComplexMat theMatrix=(dComplexMat)mxCalloc(width,sizeof(dComplexVec));
theMatrix[i] = theMatrix[i-1] + height;
return theMatrix;

appearing in the code before.

Optimistic as ever I expected it to compile and run as it had before. However, the mex compilation gives the warnings

Warning: You are using gcc version "4.6.3-1ubuntu5)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:

dwt.c: In function ?multiMRFWD1D?:
dwt.c:186:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dwt.c:187:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dwt.c:188:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dwt.c:189:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

and the program that uses this function exits with a segmentation fault.

The only idea I had was make all the numbers that become pointers long int instead of int - that does not seem to do it.

I'm not sure where the error is: whether there is something wrong with lines 186-189 or inside the dComplexMake2D() routine? The gcc version warning comes up all the time; could it not be safe to ignore this any more?

Many thanks

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.