Compiler: $PUSH/$POP support for the $OPTIMIZATION
Issue
As reported in documentation#39464 (closed), $PUSH/$POP recovery does not work for the $OPTIMIZATION directive, and therefore optimization is disabled until the end of the unit.
Workarounds
-
Use
{$OPTIMIZATION DEFAULT}, but it does not allow nesting like$PUSH/$POP. Besides, no one will use it as long as they think$PUSH/$POPworks. -
Move procedures that disable optimization to the end of the unit (example). This isn't a scalable solution, and optimization will still be disabled until the end of the procedure.
Request
Other local directives work correctly within $PUSH/$POP, so the same is expected for the optimization directive. It would be useful to allow them to be used to control the optimization level.