[coldfire-gnu-discuss] Optimizing problem
Nathan Sidwell
nathan at codesourcery.com
Sat Jan 6 14:35:28 UTC 2007
DMS Tech, John wrote:
> When I use the optimize option –O1 I have a problem that a small delay
> loop, used in a boot-loader program, gets optimized out of the code.
> Only the function call stays but the actual while loop is removed. Is
> there any compiler option to make sure this loop stays intact or a
> ‘__attribute__’, which will make sure this function is not optimized?
for (i = 0; i != limit; i++)
__asm__ volatile ("");
The compiler will not optimize this loop away, and the body of the loop will be
an empty asm.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan at codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the coldfire-gnu-discuss
mailing list