MIPS 3.4.0 ABI and one-sized arrays

Jim Wilson wilson@specifixinc.com
Mon Jun 7 17:22:00 GMT 2004


Eric Botcazou wrote:
> Strictly speaking, I don't think so.  Take a look at the second line in the 
> document, I see no mention of arrays.

The C language, and related languages, have no mechanism for passing 
arrays as arguments or returning them as return values.  In both cases, 
they decay to simple pointers.  Most gcc developers have C or C++ as 
their main language.  Thus, when people talk about aggregate parameters 
and return values, they sometimes assume that only structs and unions 
are affected, because they do not know of any way for arrays to be 
affected.  The intent here is to cover all aggregate types, including 
arrays.

You can find the SGI published ABI here:
http://docs.sgi.com/library/tpl/cgi-bin/download.cgi?coll=0650&db=bks&docnumber=007-2816-005
Or just visit docs.sgi.com, click on Irix6 Developer, and then MIPSPro 
N32 ABI Handbook.

On page 7, it says "Structs, unions, or other composite types ...".  A 
little later it says "Array fields of structs are passed like unions. 
Array parameters are passed by reference (unless the relevant language 
standard requires otherwise)."  So it looks like we need two different 
mechanisms for passing arrays, depending on whether they are structure 
fields or standalone objects.

Since we can't write C/C++ testcases that have array parameters, it 
isn't possible for C/C++ developers to have gotten this part of the ABI 
correct.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list