The patch below is applied in egcs-1.1. Message forwarding in
the GNUstep framework (gstep-base) relies on this. I didn't experience
any side effects of this "workaround" on a sparc Solaris
platform. However this workaround affects the all compilers of the egcs
package.

From: Richard Henderson <rth@dot.cygnus.com>
To: Matthias.Klose@cs.tu-berlin.de, scottc@net-community.com
Subject: Re: patch for expand_builtin_apply for sparc architecture
Date: Mon, 16 Feb 1998 05:11:32 -0800

In article <199802160833.JAA11275.cygnus.egcs.bugs@gargleblaster.cs.tu-berlin.de>,
Matthias Klose <Matthias.Klose@cs.tu-berlin.de> wrote:
>The following patch fixes the generation of an 'unimp 4095'
>instruction for the expansion of __builtin_apply on the sparc
>architecture; fix by Scott Christley (<scottc@net-community.com>), but
>doesn't seem to be submitted to the the egcs list.

You'll have to submit a test case and an explanation of why you think
this is correct.  The Sparc32 ABI calls for an unimp instruction to
be emitted following calls to functions that return structures.  The
0-4095 immediate is commentary, but that's all the room in that field
so we cannot simply remove the mask.

My guess is that it is yet another example of why __builtin_apply
is inadequate for the needs of all but completely stack-based calling
conventions and should not be used.


r~

*** gcc/config/sparc/sparc.md.orig	Mon Aug 31 18:26:17 1998
--- gcc/config/sparc/sparc.md	Mon Aug 31 18:37:56 1998
***************
*** 5715,5720 ****
--- 5715,5721 ----
  #endif
  
    if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0)
+ #if 0
      emit_call_insn
        (gen_rtx_PARALLEL (VOIDmode,
  		gen_rtvec (3, gen_rtx_CALL (VOIDmode, fn_rtx, nregs_rtx),
***************
*** 5721,5726 ****
--- 5722,5735 ----
  			   GEN_INT (INTVAL (operands[3]) & 0xfff),
  			   gen_rtx_CLOBBER (VOIDmode,
  				    gen_rtx_REG (Pmode, 15)))));
+ #else
+     emit_call_insn
+       (gen_rtx_PARALLEL (VOIDmode,
+ 		gen_rtvec (3, gen_rtx_CALL (VOIDmode, fn_rtx, nregs_rtx),
+ 			   operands[3],
+ 			   gen_rtx_CLOBBER (VOIDmode,
+ 				    gen_rtx_REG (Pmode, 15)))));
+ #endif
    else
      emit_call_insn
        (gen_rtx_PARALLEL (VOIDmode,
