This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in x86-64 psABI or in gcc?
Hi,
Michael Matz wrote:
> On Wed, 9 Dec 2009, Andrew Haley wrote:
>
>>> The intent of H.J.'s proposal is to require bits <7:1> == 0 in all cases
>>> (and higher bits as don't cares, the same way a char is passed), as
>>> opposed to the current text which requires <63:1> == 0 when passed as
>>> registers or on the stack (and <7:1> == 0 when stored in a memory
>>> object.) Furthermore, the current psABI text is inconsistent for
>>> arguments are return values; this is a bug in the wordsmithing of the
>>> text rather than intentional, if I remember the original discussions
>>> correctly.
>> Surely Postel's Law applies:
>>
>> Be conservative in what you do; be liberal in what you accept from others.
>>
>> So, return values should be zero-extended to the full word, but we shouldn't
>> assume that parameters will be.
>
> We also try to be efficient (meaning not doing booleanization at producer
> _and_ consumer side), that's why we define an psABI at all. So, while
> generally a good principle, it shouldn't be applied blindly :)
Yeah, but maximizing efficiency, while generally a good principle, shouldn't
be applied blindly either. :-)
AIUI, the proposal on the table is to change the psABI in a way that removes a
guarantee, i.e. in the opposite direction from the robustness principle. So,
at least in theory, we might break things. And, I remember from a good deal
of libffi hacking that I had to do last time, this is a nonzero risk.
Andrew.