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

Different code with expected after compiling with Intel C++ Compiler

jphui
Beginner
317 Views
I hit some problems while compiling our applications on LinuxIA with Intel C++ Compiler 10.1.008 trial version. Could somebody give me some help?
In my application, there are some codes like:
pPoolDoNotTrackMemLeak = ((::new ((this), "/calm/svr/sql/generic/source/optimizer/optserver.icpp", 230) MemLeakManager(this)) + (this)->PoolNewEnd());
After compiling with the options "-c -Wall -fsigned-char -fpermissive -finline -Winline -g -O0 -fexceptions", I can see the assembly code as below:
0x4000000003a2b6e0 <_ZN7OptPoolC9EP8proc_hdr+2144>: [MMI] adds r36=224,r12;;
0x4000000003a2b6e1 <_ZN7OptPoolC9EP8proc_hdr+2145>: ld8 r37=[r36]
0x4000000003a2b6e2 <_ZN7OptPoolC9EP8proc_hdr+2146>: nop.i 0x0;;
0x4000000003a2b6f0 <_ZN7OptPoolC9EP8proc_hdr+2160>: [MIB] mov r86=r37
0x4000000003a2b6f1 <_ZN7OptPoolC9EP8proc_hdr+2161>: nop.i 0x0
0x4000000003a2b6f2 <_ZN7OptPoolC9EP8proc_hdr+2162>: br.call.sptk.few b0=0x4000000003a2ad80 <_ZN7OptPool10PoolNewEndEv>;;
0x4000000003a2b700 <_ZN7OptPoolC9EP8proc_hdr+2176>: [MII] mov r36=r8
0x4000000003a2b701 <_ZN7OptPoolC9EP8proc_hdr+2177>: mov r37=552
0x4000000003a2b702 <_ZN7OptPoolC9EP8proc_hdr+2178>: nop.i 0x0
0x4000000003a2b710 <_ZN7OptPoolC9EP8proc_hdr+2192>: [MMI] adds r38=224,r12;;
0x4000000003a2b711 <_ZN7OptPoolC9EP8proc_hdr+2193>: ld8 r39=[r38]
0x4000000003a2b712 <_ZN7OptPoolC9EP8proc_hdr+2194>: addl r40=218784,r1;;
0x4000000003a2b720 <_ZN7OptPoolC9EP8proc_hdr+2208>: [MII] ld8 r41=[r40]
0x4000000003a2b721 <_ZN7OptPoolC9EP8proc_hdr+2209>: mov r42=231
0x4000000003a2b722 <_ZN7OptPoolC9EP8proc_hdr+2210>: mov r86=r37
0x4000000003a2b730 <_ZN7OptPoolC9EP8proc_hdr+2224>: [MMI] mov r87=r39;;
0x4000000003a2b731 <_ZN 7OptPoolC9EP8proc_hdr+2225>: mov r88=r41
0x4000000003a2b732 <_ZN7OptPoolC9EP8proc_hdr+2226>: mov r89=r42
0x4000000003a2b740 <_ZN7OptPoolC9EP8proc_hdr+2240>: [MMI] adds r20=152,r12;;
0x4000000003a2b741 <_ZN7OptPoolC9EP8proc_hdr+2241>: st8 [r20]=r36
0x4000000003a2b742 <_ZN7OptPoolC9EP8proc_hdr+2242>: nop.i 0x0
0x4000000003a2b750 <_ZN7OptPoolC9EP8proc_hdr+2256>: [MIB] nop.m 0x0
0x4000000003a2b751 <_ZN7OptPoolC9EP8proc_hdr+2257>: nop.i 0x0
0x4000000003a2b752 <_ZN7OptPoolC9EP8proc_hdr+2258>: br.call.sptk.few b0=0x4000000003a2eb80 <_ZnwmP7OptPoolPci>;;

Obviously, the function (this)->PoolNewEnd() is called firstly. Then, "new" is called. This is different with what we expected. We hope "new" is firstly called and then the function "this->PoolNewEnd". And it is so on othe platforms.

I don't know if I missed some important compiler options. Could you please shed some light to me? Appreciate for your any helps.

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
317 Views

Are you missing a punctuation character (operator) in front of MemLeakManager?

What you posted is using whitespace between ::new(...) and MemLeakManager(...)

pPoolDoNotTrackMemLeak =
(
(
::new
(
(this),
"/calm/svr/sql/generic/source/optimizer/optserver.icpp",
230
)
MemLeakManager(this)
)
+ (this)->PoolNewEnd()
);

Additionally, If you intend to have the user deined ::new perform an allocation I beleave you ment to use

::new((*this),...
Jim Dempsey
0 Kudos
jphui
Beginner
317 Views
Thank you very much for your reply. :-)

Yes, there is a whitespace between ::new(...) and MemLeakManager(..). But this will not affect anything. I tried to remove the whitespace just now but the issue is still there. :-(

Thanks again for your kindly help.

0 Kudos
Reply