This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Generated assembler output doesn't store / restore registers
- From: Marcus Meissner <meissner at suse dot de>
- To: Stefan Staiger <stefan dot staiger at gmx dot net>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 10 Aug 2002 18:03:27 +0200
- Subject: Re: Generated assembler output doesn't store / restore registers
- References: <001001c24071$d7dd93a0$fe78a8c0@FRITZweb>
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