This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: gas will miscompile with SPARCompiler 3.0.1 on Solaris7


On 6 Apr 2000, Alexandre Oliva wrote:

> [back to the list]
> 
> On Apr  6, 2000, Alan Modra <alan@linuxcare.com.au> wrote:
> 
> > It's either from line 3026 of gas/config/tc-sparc.c, or line 971 of
> > gas/write.c  Maybe you could change one (or both, to make sure I know
> > what I'm talking about!) of the error messages to see which it is?
> 
> Instead, I run it within a debugger and found out it was in line 3026
> of gas/config/tc-sparc.c.
> 
> The problem is in in_signed_range().  bfd_signed_vma is `long long',
> whose size is 8 bytes.  When it does:
> 
>   /* Sign-extend the value from the architecture word size, so that
>      0xffffffff is always considered -1 on sparc32.  */
>   if (sparc_arch_size == 32)
>     {
>       bfd_signed_vma sign = (bfd_signed_vma)1 << 31;
>       val = ((val & 0xffffffff) ^ sign) - sign;
>     }
> 
> val, that was -112ll, becomes -4294967408ll, which certain doesn't fit
> in 13 bits.  Jakub, it seems that you are responsible for having
> introduced this change, back in Sept 1998.  Do you still remember why
> it was necessary?  Can't we just remove it?

Alexandre, to get this result your sun compiler apparently is sign
extending 0xffffffff.  Can you come up with an expression that results in
0x00000000ffffffff for the mask?  If you can, that will cure the problem.

Perhaps
       val = (((bfd_vma) val & 0xffffffff) ^ sign) - sign;

Regards, Alan Modra
-- 
Linuxcare.  Support for the Revolution.


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