Generated assembler output doesn't store / restore registers

Marcus Meissner meissner@suse.de
Sat Aug 10 09:03:00 GMT 2002


On Sat, Aug 10, 2002 at 03:28:37PM +0200, Stefan Staiger wrote:
> GCC version: G++ v 3.1
> Platform:         Linux (kernel 2.4.0 - 4GB, SuSE 7.1 distro) on a
>     Intel Pentium 3 at 500 MHz
> Problem in:     generated assembler output
> Description:    generated function modifies eax and edx, but doesn't
>     store/restore the original contents before returning to the caller
> 
> 
> Hello GCC hackers,
> 
> I have the following problem with G++:
> In the assembler output which the compiler generated for
> even simple code files, it uses the registers eax and edx,
> but doesn't store and restore them in the function. Thus,
> the contents of those registers are destroyed which results in
> mysterious program behaviour.

The x86 ABI in use specifies eax and edx as non-saved registers during
function calls.

The calling function needs to save them.

Ciao, Marcus



More information about the Gcc-bugs mailing list