Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Intel 12.0 buggy code with -03 (linux 64 bit)

Martin_V_2
Beginner
906 Views
Hello,

is -O3 already expected to build correct code?
I found the page from 2009:

http://software.intel.com/en-us/articles/use-intel-compilers-successfully-for-6
"Using -O3, the compiler performs aggressive optimizations, and the
optimizer occasionally generates incorrect code."

We found another example for a misoptimisation.

(Attached is the sample Application.)

Compile the sample Application :

icpc -O3 test.cpp -o test

run it:

/test
dxx[0] = 2.885465e+01

Now exchange line 115 with line 116:

compile:

icpc -O3 test.cpp -o test

run:

./test
dxx[0] = 0.000000e+00


The problem goes away when building with -O2 or using
Intel 11.1 compiler.

So, if O3 should work, this is a bug. Otherwise this sample App
can be use to fix the problem.

regards,

Martin

0 Kudos
2 Replies
mecej4
Honored Contributor III
906 Views
Here is the complete link to the Intel article quoted above:

Intel article

The optimization bug reported above is not seen with the 12.0.4 compiler on Windows (32 and 64 bit).
0 Kudos
Om_S_Intel
Employee
906 Views

I get same output when I swap lines 115 and 116 using icc12.0.4.191. Please upgrade your compiler.

0 Kudos
Reply