This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] ABI change for variable sized types


Richard Kenner wrote:

> That's not a problem at all. There's absolutely no requirement in
> Ada that variable-sized types be passed by value. The only types that
> *must* be able to be passed by values are scalars.


Ok, that's good enough for me. I've checked in the patch.

Actually, to be very precise, it was pointed out to me a day after I sent
the above that several recent additions to the Ada languages require it
to support a pragma that specifies that a type "interfaces to C" and is
passed by value.  But I don't see that as an issue because, as far as I
know, no C compiler actually *does* pass them by value.

I am sure that is wrong, because the pragma and convention in Ada were put there because some common targets *do* pass records by value. The convention is C_Pass_By_Value. These were not invented by GNAT, they are implemented in all Ada 95 compilers. I am sure they were put there for a reason, in fact I remember that one version of GNAT malfunctioned on some target till we implemented this. Note that the issue here is not whether things are passed by value conceptually, but rather whether they can be passed in registers. In the absence of C_Pass_By_Value, the Ada standard requires that records be passed by passing a pointer.

So I still agree with your patch and if some language-lawyer does raise this obscure issue at some point in the future, we'll deal with it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]