Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

C++ Loop Optimization Bug

$
0
0

Dear all,

I stumbled upon a bug where icpc apparently causes a loop not to be executed. I've attached a minimal example which reproduces the behavior. I've tested with icpc 15.0.3 20150407. The bug is present with -O2 and -O3, but not -O1 nor -Os:

 

gentryx@neuromancer ~ $ # expected output:

10:49:11 - 0
gentryx@neuromancer ~ $ g++ -O3 test.cpp -o test && ./test   
max: (250, 150), min: (150, 50)

10:49:19 - 0
gentryx@neuromancer ~ $ # buggy behavior:

10:49:41 - 0
gentryx@neuromancer ~ $ icpc -O2 test.cpp -o test && ./test  
max: (150, -1000), min: (1000, 50)

10:49:45 - 0
gentryx@neuromancer ~ $ icpc -O3 test.cpp -o test && ./test  
max: (150, -1000), min: (1000, 50)

10:49:48 - 0
 

AdjuntoTamaño
Descargartest.cpp2.19 KB

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>