- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My friend, justdemon (on telnet://ptt.cc), found a strange problem in Intel C++ Compiler.
I can reproduce this problem and I can't explain it.
The problem can be reproduced by the following three source files:
GAMER.h
Main.cpp
Refine.cpp
(You may need to include cstdlib header for correctly compiling them.)
The golden result should ouput the values:
1
1
0
0
However, if you compile these files by icpc without any option, i.e.:
icpc Main.cpp Refine.cpp
, and execute the program, you will get the stange result:
0
0
1
0
And if you want to debug it by recompiling the program by:
icpc -g Main.cpp Refine.cpp
, unfortunatelly, you will find the output result of this compilation is correct:
1
1
0
0
Thus, unfortunately, you can't use idb for debugging this program.
How to explain this strange problem?
Is this a bug of Intel C++ Compiler?
My Intel C++ Compiler version is 11.1 20100203 (Intel 64).
I can reproduce this problem and I can't explain it.
The problem can be reproduced by the following three source files:
GAMER.h
Main.cpp
Refine.cpp
(You may need to include cstdlib header for correctly compiling them.)
The golden result should ouput the values:
1
1
0
0
However, if you compile these files by icpc without any option, i.e.:
icpc Main.cpp Refine.cpp
, and execute the program, you will get the stange result:
0
0
1
0
And if you want to debug it by recompiling the program by:
icpc -g Main.cpp Refine.cpp
, unfortunatelly, you will find the output result of this compilation is correct:
1
1
0
0
Thus, unfortunately, you can't use idb for debugging this program.
How to explain this strange problem?
Is this a bug of Intel C++ Compiler?
My Intel C++ Compiler version is 11.1 20100203 (Intel 64).
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this is a bug in the compiler.
Please refer to the other thread for the latest info. Thanks for reporting and the testcase.
The work-around is to build the "buffer.cpp" with -O1.
Jennifer
Please refer to the other thread for the latest info. Thanks for reporting and the testcase.
The work-around is to build the "buffer.cpp" with -O1.
Jennifer
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this is a bug in the compiler.
Please refer to the other thread for the latest info. Thanks for reporting and the testcase.
The work-around is to build the "buffer.cpp" with -O1.
Jennifer
Please refer to the other thread for the latest info. Thanks for reporting and the testcase.
The work-around is to build the "buffer.cpp" with -O1.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your assistant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did ask this before, but as my post was dropped, I'll ask again: was -fp:source tried, in case the failure is associated with the intentional standard violations implied by default? This option removes most causes of numerical variations from strict standard compliance, with the only major disabled optimization being vector sum reductions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't have anything to add to Jennifer and Tim's posts, but I thought this was really useful to point out -- by default, the compiler optimization setting is -O2, so when this poster did the following:
icpc Main.cpp Refine.cpp
The compiler effectively does:
icpc -O2 Main.cpp Refine.cpp
Now when you add -g, the default -O setting is no longer -O2, but instead is -O0. So when you build:
icpc -g Main.cpp Refine.cpp
The compiler is doing:
icpc -O0 -g Main.cpp Refine.cpp
If you are not specifying the -O setting, and want to add -g and debug the same build, you need to explictly set -O2 like so:
icpc -O2 -g Main.cpp Refine.cpp
Then you should be able to debug any problems.
icpc Main.cpp Refine.cpp
The compiler effectively does:
icpc -O2 Main.cpp Refine.cpp
Now when you add -g, the default -O setting is no longer -O2, but instead is -O0. So when you build:
icpc -g Main.cpp Refine.cpp
The compiler is doing:
icpc -O0 -g Main.cpp Refine.cpp
If you are not specifying the -O setting, and want to add -g and debug the same build, you need to explictly set -O2 like so:
icpc -O2 -g Main.cpp Refine.cpp
Then you should be able to debug any problems.

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