[cxx-abi-dev] Revisiting Issue C-18: Result buffers

Mark Mitchell mark at codesourcery.com
Wed May 4 23:36:00 UTC 2005


Cary Coutant wrote:
> I was recently asked about Section 3.1.4 (Return Values) in the C++ ABI 
> spec, where it states:
> 
> "... if the return value type has a non-trivial copy constructor or 
> destructor, the caller allocates space for a temporary, and passes a 
> pointer to the temporary as an implicit first parameter preceding both 
> the this parameter and user parameters. The callee constructs the return 
> value into this temporary. On Itanium, the pointer is passed in out0, 
> different from other large class result buffer pointers, passed in r8."
> 
> The HP compiler follows this convention, but g++ on HP-UX does not, 
> causing a binary incompatibility between the two compilers.
> 
> I dug up Issue C-18, which purports to have changed this convention to 
> use r8, just as the base C ABI would, and as g++ does:

Yes, I distinctly remember lobbying to eliminate the special Itanium 
rule, and I remember the change being accepted.  So, I belive the G++ 
behavior to be correct -- although you are of course correct that 
somehow the specification was never updated to reflect that.  The change 
was made before the specification moved to our web site, so I really 
don't know what happened.

I have checked in the attached change.  If anyone objects to that, 
please let me know.

> What does the C++ ABI test suite check for?

Our testsuite doesn't check for particular registers; instead, it checks 
this constraint by calling a function from C++ and implementing it in C, 
with the pointer made explicit, and then checks that the value is really 
there.  So, essentially, it checks for the G++ behavior, not the special 
  Itanium behavior.

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: abi.patch
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20050504/998bf367/attachment.ksh>


More information about the cxx-abi-dev mailing list