Invoking any Intel compiler with a Cray wrapper with -g defaults to -O2 optimization contrary to the Intel compiler man pages
January 30, 2014 (0 Comments)
Status: Filed bug 776949 with Cray but they regard it as an Intel feature.
The Intel compiler man pages ifort, icc, and icpc all state that the -g optimization causes the default optimization to be -O0.
This is not true if the Cray wrappers, ftn, cc, or CC are used. In that case the default optimization lever with -g is -O2. This is due to the fact that the Cray wrappers fill in the -x architecture flag which gives a default optimization level of -O2 regardless of the value of -g.
Workaround: specify -g -O0 if you want no optimization.
Cray declined to fix this since they regard it as an Intel feature.