Assembler (Intel) inconsistencies in 2.0.x, Was: Re: [fpc-devel] Bug: compilation loop in 2.0.2 when using -So

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Aug 18 15:03:32 CEST 2006


On 18 aug 2006, at 14:56, Konstantin Münning wrote:

> So a programmer should not need exactly to know if/when a variable is
> cached in a register or saved on the stack (=memory) and when
> referencing it the same way the same result should be expected.

A programmer actually must always be aware of how the parameters are  
passed, because otherwise in case of register parameters he can  
unknowingly overwrite some parameters while "loading" others into  
registers. So he almost always needs different code anyway.

> Here an example where the same source code is compiled differently  
> which
> should not depend on calling convention, register caching or  
> whatsoever:
>
> PROCEDURE Test(l:LongInt);ASSEMBLER;
>  ASM
>   mov eax,[l]
>  END;
>
> PROCEDURE Test;ASSEMBLER;
>  VAR l:LongInt;
>  ASM
>   mov eax,[l]
>  END;

Well, it does depend on it and it will probably not be changed, since  
that would break too much compatibility.


Jonas


More information about the fpc-devel mailing list