The follow sample code looks OK to me but always fails executing on Solaris with SIGBUS error if compiled with GCC 4.0.2, however it runs fine if compiled with GC开发者_StackOverflow社区C 3.4.2 version. Any thought?
//params is a pointer to a structure Param, which has a member d whose type is double. It was initiated/allocated through JNI.
params->d = 5.0;
double *b = ¶ms->d;
double c = params->d;
c += *b;
SIGBUS was raised at the last line, i.e. dereferencing the pointer and accessing the content is causing the problem.
Thanks, Charles
That sounds like an alignment issue to me. IIRC, double
has to be aligned to 64 bit.
精彩评论