I'm going nuts with my code, because what is happening is beyond my comprehension. When I compile my code with -g option, or -check all, or -check bounds flag, the code runs perfectly fine, though, as you can guess, very slow.
Whenever I use any optimization flag, the code fails to run, gives random segmentation faults. More importantly, the code has something of this sort:
When I add WRITE(6,*) x(1) at the end, it gives me a number totally different from what I set it to. (gives me zero) x is an allocatable array which is properly allocated to be of size 64.
Here are some technical details:
I do not have Intel C/C++ compiler and therefore OpenMPI was compiled with gcc, g++ and ifort combined, with no special flags. If I use gfortran, the code runs with no problems, regardless of the optimization level.
I also tried to use MPICH2 and still the problem persists. It's not specific to OpenMPI. There is a compiler bug in Intel Compiler, or, there is an incompatibility between GCC 4.2 and ifort.
If you are sure that the issue is related to Intel Fortran compiler you can submit a request via Premier porviding a reproducer. Unfortunately we cannot help you with Mac OS because we don't even have this OS on our servers.
I just can't believe what I see. The compiler screws up for some reason for the following code whenever I use default optimization. When I turn off optimization it works just fine... Very odd. The screen output, when I run it on 4 nodes is,