This is the mail archive of the gcc@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: [gcc-in-cxx] bootstrap fails


On Sat, 21 Mar 2009, Ian Lance Taylor wrote:

> > ../.././gcc/config/i386/i386.c:3282: error: comparison is always true
> > due to limited range of data type
> 
> #define IN_RANGE(VALUE, LOWER, UPPER) \
>   ((unsigned HOST_WIDE_INT) (VALUE) - (unsigned HOST_WIDE_INT) (LOWER) \
>    <= (unsigned HOST_WIDE_INT) (UPPER) - (unsigned HOST_WIDE_INT) (LOWER))

>   gcc_assert (IN_RANGE (ix86_arch, 0, 255));
> 
> It all looks fine to me.

Sounds like enums in C++ having limited ranges meaning this is an 
assertion of something the compiler knows to be true.  (This actually 
illustrates why these warnings can sometimes be problematic - you write a 
check for something that may or may not be always true depending on the 
sizes of types, the handling of enumerations, etc., and when it is always 
true the compiler complains.  But in other cases they can be useful.)

-- 
Joseph S. Myers
joseph@codesourcery.com


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