This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: AIX regressions


> cc: gcc-bugs@gcc.gnu.org
> Date: Sat, 01 Dec 2001 23:35:07 -0500
> From: David Edelsohn <dje@watson.ibm.com>
> 
> 	Compiling emit-rtl.c generates the following warnings:
> 
> /gcc/dje/src/gcc/emit-rtl.c: In function `gen_lowpart_common':
> /gcc/dje/src/gcc/emit-rtl.c:1064: warning: left shift count >= width of type
> /gcc/dje/src/gcc/emit-rtl.c:1065: warning: left shift count >= width of type
> 
> The problematic section is:
> 
>       /* Now, pack the 32-bit elements of the array into a CONST_DOUBLE
>          and return it.  */
> #if HOST_BITS_PER_WIDE_INT == 32
>       return immed_double_const (i[3 * endian], i[1 + endian], mode);
> #else
>       if (HOST_BITS_PER_WIDE_INT != 64)
>         abort ();
> 
>       return immed_double_const (i[3 * endian] | (i[1 + endian] << 32),
>                                  i[2 - endian] | (i[3 - 3 * endian] << 32),
>                                  mode);
> #endif
> 
> 	The array "i" is defined as type "long" not "HOST_WIDE_INT":
> 
>       long i[4];  /* Only the low 32 bits of each 'long' are used.  */
> 
> but the test is HOST_BITS_PER_WIDE_INT.  
> 
> 	This patch must have been written when HOST_WIDE_INT always was
> "long" because now it can be "long long".  The test does not guarantee
> that a long is 64 bits.  I am bootstrapping with "i" defined as
> HOST_WIDE_INT.

Aah.  Each element of 'i' only needs to be 32 bits wide (and in fact
has to be of type 'long', look at the prototype of etardouble() in
real.c), the correct fix is to cast it to HOST_WIDE_INT before
shifting it.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>


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