Bus Error

This is likely not the right place to post this question, but without getting anywhere I figured I’d try.

Is there a good way to use the debugger to try to solve memory errors?

I’m getting a “Bus Error”, or “Signalled SIGSERV at 0x1001081F9…” and I have no idea why. It seems to happen the first time my program writes to a variable defined as:


The line causing the error is simple
HDELT = 300.0;

I narrowed it down to this using print statements all around it (I come from a PHP background and have never had to rely on debuggers.)

I know the code I pasted is right and clearly can’t be solely responsible for the error, but I don’t know where else to look. Does any one have any idea?

This is running on a MacPro 10.6.1 (Snow Leopard), dual processor x86_64 (Quad-Core Intel Xeon). it is compiled to run with OpenMP, but I’ve limited it to one thread to avoid concurrency issues (even though this code isn’t in a parallel block.)

Anyone see this before? Or have any suggestions on how to find the cause?


Hi khea_actua1,

A Bus error means that the program is accessing non-aligned data or the data’saddress doesn’t exist. Why this is occurring on this common block, I unfortunately don’t know.

What flags are you compiling with? Is the common block used in an OpenMP threadprivate clause? Does the program run if you don’t compile with OpenMP (i.e. remove -mp)? How is the “TIMES” common block used/delcared elsewhere in the program?

  • Mat

Thanks for the reply!

The same problem occured with and without OpenMP.

I did however manage to solve it, after 8 hours of frustration, all it took was initializing HDELT with a value, ie:

REAL :: HDELT[b] = 0.0[/b]

I’m not sure why this works, as I was able to print out the non-initialized HDELT value (usually was equal to 3006.6 or something…)