On Wed, Jul 31, 2002 at 02:51:25PM +0200, Andreas Schwab wrote: > |> Function return values must be declared (and used) properly on m68k, > |> pointer values are returned in reg a0, ints d0. I would be surprised > |> if m68k was the only arch that gets broken by this.. > > Actually, this should not be a problem, because functions returning a > pointer put the return value in both registers, to support broken > programs.
it is still possible to run into trouble by scrweing it up the other way round: write a function that returns int and call it with a cast to a pointer-returning function. The compiler must expect the return value in a0 but int-returning functions don't do that. Broken beyond imagination but I have seen software doing this. > |> expecting 'long' result from pointer-returning functions would work > |> as long as you don't use -fomit-frame-pointer but is a horrible hack. > > I don't think that -fomit-frame-pointer has any influence on this, but if > it does, then only by chance. it has, the code to generate the extra a0->d0 move is in FUNCTION_EXTRA_EPILOGUE which gets omitted with -fomit-frame-pointer Richard