Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29278 Discussions

Controlling internal compiler optimizer

ereisch
New Contributor II
426 Views
Is there a way to control (in code) the internal optimizer (not the OpenMP optimizer.....just the regular -O1, -O2, -O3 levels) to the compiler? I have a section of code which the compiler is optimizing away, which I do not want it to remove. (The optimizer is behaving correctly -- this section of code is never reached, but we use this technique to explicitly link in certain versions of function calls at various link stages.) I tried searching the documentation, but all I could find references controlling the OpenMP optimizer.

Thanks
0 Kudos
1 Reply
TimP
Honored Contributor III
426 Views
There's an ifort directive
!dir$ optimize:0
placed in the top of a subroutine turns off optimization for that entire subroutine

I suppose you could try this to make a work-around to avoid dropping a linkage reference, not that it was intended that way.
0 Kudos
Reply