[fpc-devel] Optimization stops near inline asm

Alexander Klenin klenin at gmail.com
Mon Oct 3 08:27:47 CEST 2011


the following code:
{$mode objfpc}
var
  a: Integer;
begin
  a := a + 1;
  asm nop end;
end.

generates (under -O2):

	movl	U_P$PROGRAM_A,%eax
	incl	%eax
	movl	%eax,U_P$PROGRAM_A
	nop

instead of a single "incl".
removing either "asm" statement OR $mode directive
reinstates the optimization (although in the latter case with "incw",
of course).

This obviously never matters in practice, but may be a symptom of some more
serious problem. Should I file a bug report?

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list