I have the same version of the compiler.
At the moment, in RIDE, the "optimization level" option is not a "major" option, and a "make" will not force to recompile a file when you change this option. We will change the attribute of this option to force to recompile.
Now, when the optimization level is set to "Size optimization", no code is generated for this useless loop. But when I set the level to "No Optimization" and I force to recompile the file, the loop is there, and the codecoverage counter reports that it is executed 100 times.