This simple program returns the wrong result, without error, in the IDE but fails optimised comilation indicating that the error is on the "End Sub" of App_start whereas it's the semicolon at the end of the line in the For loop that is the problem.
Code:
Sub Globals
End Sub
Sub App_Start
Msgbox(DoMaths)
End Sub
Sub DoMaths
For i = 0 To 10
l = l + i;
Next
Return l
End Sub