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
- To: alan at linuxcare dot com dot au
- Subject: Re: gas will miscompile with SPARCompiler 3.0.1 on Solaris7
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 7 Apr 2000 17:50:02 -0700
- CC: aoliva at cygnus dot com, binutils at sourceware dot cygnus dot com, jakub at redhat dot com
- References: <Pine.LNX.4.21.0004080943040.16998-100000@front.linuxcare.com.au>
Date: Sat, 8 Apr 2000 10:12:47 +1000 (EST)
From: Alan Modra <alan@linuxcare.com.au>
> Casts to a type of unknown size should only be used in unusual
> circumstances.
There are plenty of other places where we assume that "int" and
"unsigned int" are at least 32 bits. Are these all bugs?
No, those are OK. What I am uncomfortable about is a cast to an
unknown size. It looks wrong to me. It's hard to understand why it
is there. In this particular case, its effect should be nil. If you
use a cast to addressT or bfd_vma, I would like it better. But I
don't know whether it would work.
> I don't really want to add them merely to work around
> a bug in a proprietary compiler.
I mildly disagree with this philosophy. binutils is one of the
"bootstrap" packages. We really should cater to old compilers, much in
the same way as gcc tries to. The whole world isn't linux (yet) ;-)
Sure, we should support K&R C, but I expect that Sun will fix this
particular bug in their next compiler release. Catering to old
compilers doesn't include catering to all old compiler bugs. When we
do cater to old bugs, we should only do it just enough to permit
people to build the GNU tools.
> Besides, adding casts this way is
> just a wart; any future maintainer would be right to simply remove
> them, since they are clearly unnecessary.
N_ONES is more of a wart, IMNSHO. How about using
#ifdef __STDC__
#define UNSIGN(x) x ## U
#else
#define UNSIGN(x) ((unsigned) x)
#endif
I don't want to spread that across the sources either. There is no
obvious reason to use it, and there is no penalty for not using it,
which means that it will be used inconsistently, which means that it
will be worse than useless: it won't always help, and it will be yet
another obscurity in the sources.
It would be OK with me to use something like this, or even the
original cast to unsigned, in just the cases we need to bootstrap on
Solaris, adding a comment for each case including the version number
of the compiler and the OS.
Ian