- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using Intel ICC 18, I encountered the following bug in
int p = ((l == 0) ? 0 : (1 << l));
Here is how to reproduce:
[<snip> Intel18]$ cat main.cpp #include <iostream> int main(int, char**){ // for l = 0, 1, 2, 3, ... // we want to output the sequence // p = 0, 2, 4, 8, ... for(int l=0; l<4; l++){ int p = ((l == 0) ? 0 : (1 << l)); std::cout << p << " "; } std::cout << std::endl; return 0; } [<snip> Intel18]$ icc -v icc version 18.0.1 (gcc version 6.3.0 compatibility) [<snip> Intel18]$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=<snip> Target: x86_64-pc-linux-gnu Configured with: <snip> --disable-multilib --enable-languages=c,c++,fortran Thread model: posix gcc version 6.3.0 (GCC) [<snip> Intel18]$ icc main.cpp -o run_intel [<snip> Intel18]$ ./run_intel 1 2 4 8 [<snip> Intel18]$ g++ main.cpp -o run_gcc [<snip> Intel18]$ ./run_gcc 0 2 4 8
Workaround is to flip the if-statement:
int p = ((l > 0) ? (1 << l) : 0);
Does anyone know the "official" way of reporting such bugs?
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This seems to be fixed in 19.0 Update 3:
$ rm run_intel ; icpc t.cpp -o run_intel&& ./run_intel
0 2 4 8
$ icc -v
icc version 19.0.3.199 (gcc version 6.3.0 compatibility)
$ cat t.cpp
#include <iostream>
int main(int, char**){
for(int l=0; l<4; l++){
int p = ((l == 0) ? 0 : (1 << l));
std::cout << p << " ";
}
std::cout << std::endl;
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank for checking on this, Viet!
I'll see when our IT is planning on upgrading the clusters to Intel 19.
Best!


Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page