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: gcc bug WRT warning that should not be displayed


Mo DeJong wrote:
   long val2 = 1; /* incorrect warn when val2 is a long */
   int c2 = (
         ((long long) val2) <
         ((long long)(-2147483647L - 1))
        );

The result of the compare will always be false, so the warning is correct.


The long variable val2 can not hold a value smaller than LONG_MIN. Adding casts to long long does not change this fact.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com



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