Community
cancel
Showing results for 
Search instead for 
Did you mean: 
emmanuel_attia
Beginner
109 Views

Wrong optimization when calling virtual function implemented both in a plugin and in the calling module.

Hi
Intel 12 Compiler seems to inline virtual functions where he should'nt (when optimization and IPO enabled).

The given solution should output (tested with Intel Compiler 11 and Visual C++ 2005/2008)
Caller implementation
Plugin implementation
But if i compile the Caller (EXE) with Intel 12 (Compiler XE 12.0.2.154 [IA-32]), with /O2 and /Qipoit outputs
Caller implementation
Callerimplementation
This is very surprising from a professionnal compiler to have such a subjective interpretation of the keyword "virtual"...
Regards,
Emmanuel
0 Kudos
10 Replies
Om_S_Intel
Employee
109 Views

This seems a bug in Intel compiler. I am investigating the issue. I will update when done.

Om_S_Intel
Employee
109 Views

I reproduced the issue using VS2010 IDE.

I could not reproduce the issue when using command lines give below:

c:\>icl /c /Qvc10 /Zi /W3 /O2 /Oi /Qipo /Qftz- -D WIN32 -D NDEBUG -D _WINDOWS -D _USRDLL -D INTEL12BUGPLUGIN_EXPORTS -D _WINDLL -D _UNICODE -DUNICODE /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP Plugin.cpp

c:\>icl /Qoption,link,/OUT:Intel12BugPlugin.dll /Qoption,link,/DLL "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" Plugin.obj

c:\>icl /c /Qvc10 /Zi /W3 /Od /Oi /Qipo /Qftz- -D WIN32 -D NDEBUG -D _CONSOLE -D _UNICODE -D UNICODE /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP Caller.cpp

c:>icl Intel12BugPlugin.lib Caller.obj

Is there something missing?

emmanuel_attia
Beginner
109 Views

I don't understand, did you manage to reproduce the bug within the IDE or do you need me to send you a solution with Visual 2010 ?
I'm not use to command line, although running the lines you gave me the compiler outputs:
ipo: remark #11001: performing single-file optimizations
And I don't know how to force multi-file optimization (because I already tested like I said in the initial post that the bug happen only in multi-file optimization (/Qipo) and not single fine optimization (/Qip).
Obviously in single-file optimization, the compiler has no hint to issue make static call from virtual call.
emmanuel_attia
Beginner
109 Views

After some trial, I have reproduced the bug with the following command lines:
[bash]icl /c /Qvc10 /Zi /W3 /O2 /Oi /Qipo /Qftz- -D WIN32 -D NDEBUG -D _WINDOWS -D _USRDLL -D _WINDLL -D _UNICODE -DUNICODE  /EHsc  /MD /GS /Gy  /fp:precise  /Zc:wchar_t /Zc:forScope /Gd /TP Plugin/Plugin.cpp
icl /Qoption,link,/OUT:Plugin.dll /Qoption,link,/DLL "kernel32.lib" "user32.lib" Plugin.obj
icl /Qvc10 /Zi /W3 /O2 /Oi /Qipo /Qftz- -D WIN32 -D NDEBUG -D _CONSOLE -D _UNICODE -D UNICODE /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t  /Zc:forScope /Gd /TP Caller/Caller.cpp Plugin.lib
[/bash]
Om_S_Intel
Employee
109 Views

I have submitted a bug report to Intel compiler development team on this. I will update the thread when I have more info on this.
Om_S_Intel
Employee
109 Views

If you use compiler option -Qopt-class-analysis- then the problem is resolved.
Om_S_Intel
Employee
109 Views

emmanuel_attia
Beginner
109 Views

Hi, thanks for your fix, it will be very usefull.
It this still considered as a bug to be solved by the Compiler Team ?
Best regards and thanks again.
Om_S_Intel
Employee
109 Views

The fix is implemeted by compiler team but it is not targeted for Intel compiler 12.0.

In case you can not manage with work-around, please let us know.
Om_S_Intel
Employee
109 Views

The issue is fixed in latest Intel C++ Composer XE 12.1. The composer is available for download from Intel download center.
Reply