Bug in x86-64 psABI or in gcc?

H.J. Lu hjl.tools@gmail.com
Wed Dec 9 17:49:00 GMT 2009


On Wed, Dec 9, 2009 at 7:49 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Wed, 9 Dec 2009, H.J. Lu wrote:
>
>> > Then fix the psABI.
>>
>> Don't we need to specify passing and returning char, short and int since
>> they are smaller than the integer class, which is eightbytes?
>
> Since the mapping from domain to bitpatterns is bijective, we don't have
> to (although if one wants to be extra anal one could say that the psABI
> expects the identity mapping).  We have to say something about _Bool only
> because this mapping is not necessarily bijective.  And in doing so we
> obviously were a bit too aggressive in specifying the bit range.
>
> So, IMO we have two sensible proposals:
> (a) specify that bits <7:1> must be zero
> (b) specify that bits <31:1> must be zero
>
> In both, the value would be in bit 0, other bits are don't
> care/unspecified.  Both cases would do the conversion at the producer
> side, when necessary, i.e. before the call, or before the return.
>
> I have no opinion which one would be better.  Defining only the low 8 bit
> might introduce partial register stalls or needless movzbl's.  Defining
> the low 32 bit might require needless movzbl in other places.
>
> There's a case to be made for (a), because that one specifies exactly the
> bits that would be stored also in memory.
>
> I'd like to hear at least from the Solaris guys what they think about the
> whole thing.

I uploaded sources and object files generated by gcc 4.4, icc 11.1
and Sun Studio 12 Update 1 at -O to:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42324

If we go with (a), no changes are needed for gcc, icc and sun studio.
All existing object files are OK.

If we go with (b), gcc 4.3 and 4.4 are broken in function return. Object
files generated by gcc 4.3 and 4.4 aren't compatible with object files
which assuming bits 1-31 in _Bool return are zero.

I think (a) is the safest option.


-- 
H.J.



More information about the Gcc mailing list