This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: gas will miscompile with SPARCompiler 3.0.1 on Solaris7
From: Alexandre Oliva <aoliva@cygnus.com>
Date: 07 Apr 2000 01:07:56 -0300
> Alexandre, to get this result your sun compiler apparently is sign
> extending 0xffffffff.
Precisely. So, it's a compiler bug. Anyway, it would be nice to fix
it, wouldn't it? Here's a patch that fixes this and a few other
similar bugs. With this patch, `make check-{gas,binutils}' passes all
tests. Ok to install? Release branch?
- val = ((val & 0xffffffff) ^ sign) - sign;
+ val = ((val & (unsigned)0xffffffff) ^ sign) - sign;
Casts to a type of unknown size should only be used in unusual
circumstances. I don't really want to add them merely to work around
a bug in a proprietary compiler. Besides, adding casts this way is
just a wart; any future maintainer would be right to simply remove
them, since they are clearly unnecessary.
What if we simply write 0xffffffffU?
Using N_ONES would be OK with me too, although it is rather awkward.
In general I agree that we should not try to fix every case where this
can be a problem. Again, it is only a bug in a proprietary compiler.
We should only fix whatever is needed to make this target work on
Solaris.
Ian