[LLVMdev] Wrong calling convention?

David Vandevoorde
Wed, 26 Mar 2008 17:59:44 -0000

On Mar 26, 2008, at 1:31 PM, Óscar Fuentes wrote:
> Óscar Fuentes <ofv at wanadoo.es> writes:
>
>> BTW, -fpcc-struct-return solves the case that motivated this thread.
>
> -fpcc-struct-return is an ABI change, hence it requires "compiling the
> world". Not acceptable.
>
> I'll be interested on hearing ideas about how to determine how a
> function returns a small struct, without knowing the internals of the
> struct.

You need to know _something_ about the internals.  GCC approximately
implements the IA-64 C++ ABI; which is fairly conventional in this
particular aspect of a C++ ABI.  See
	http://www.codesourcery.com/cxx-abi/abi.html#calls

In that ABI, if there is a "nontrivial" (that's a precise term)
copy-
constructor or destructor, the caller is responsible for allocation.

	Daveed