Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ogorodnik
Beginner
44 Views

BUG: ICL ignore disabled optimization and continue to use "dead code elimination"

BUG: ICL ignore disabled optimization and continue to use "dead code elimination"


Here is a sample code to reproduce this bug:

#pragma optimize("", off)
int f1(int x)
{
return x + 5;
_asm _emit 0x01;
_asm _emit 0x02;
}
#pragma optimize("", on)
(different intel-specified pragmas to disable optimizationNOT HELPING TOO!)

Even if I use /Od switch (to disable ALL optimization and this pragma), ICL killing my code after return, using "dead-code elimination". But I DISABLED ALL OPTIMIZATION. MSVC compiles this code (with disabled optimization) correctly (my tags 01h and 02h are placed after return x+ 5;)

This bug exist in ICL v9.x, v10.x and the latest beta of v11 (v11.1.038 Build 20090624)

0 Kudos
1 Reply
JenniferJ
Moderator
44 Views

Hi,
This has been a while. the "#pragma optimize("", off)" is supported and working now. But the original code will not work as you'd expect.

If you change the code to below, it should work. Please try the 12.1 compiler with it. You can download it from our eval center.

#pragma optimize("", off)

int f1(int x)

{

if (1)

return x + 5;

_asm _emit 0x01;

_asm _emit 0x02;

}

#pragma optimize("", on)


I used "icl /O2 /c /FA t.cpp".