0xffffffff when BFD64

Geoff Keating geoffk@cygnus.com
Fri Apr 7 12:45:00 GMT 2000


> Date: Fri, 7 Apr 2000 14:17:41 +1000 (EST)
> From: Alan Modra <alan@linuxcare.com.au>
> cc: binutils@sourceware.cygnus.com
> 
> On Fri, 7 Apr 2000, I wrote:
> 
> > Alexandre, to get this result your sun compiler apparently is sign
> > extending 0xffffffff.
...
> I guess we should check all hex constants in the range 0x80000000 to
> 0xffffffff, replacing them with const & N_ONES(32).  Blechh.
> 
> Has anyone a better idea?

This is because, IIRC, the Sun compiler is K&R C and considers all
constants to be 'int' constants unless you say otherwise.  ISO C picks
a type based on whether they fit, so such constants become 'unsigned
int'.

One easy solution is to write '0xffffffffu', which is an explicitly
unsigned constant.  There is some GCC warning flag which will complain
about this, saying 'constant is so large it is unsigned'; it is turned
on for GCC itself.

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Binutils mailing list