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: What makes this comparison always 0?


On Mon, Nov 25, 2002 at 09:02:25AM -0800, Jason R Thorpe wrote:
> #define KS_GROUP_Dead           0xf801          /* not encoded in keysym */
> #define KS_GROUP_Ascii          0xf802          /* not encoded in keysym */
> #define KS_GROUP_Keycode        0xf803          /* not encoded in keysym */
> 
> #define KS_GROUP(k)     ((k) >= 0x0300 && (k) < 0x0370 ? KS_GROUP_Dead : \
>                             (((k) & 0xf000) == 0xe000 ? KS_GROUP_Keycode : \
>                               (((k) & 0xf800) == 0xf000 ? ((k) & 0xff00) : \
>                                 KS_GROUP_Ascii)))

The warning comes when GCC pushes the outer comparison into the ?:
so we wind up with, in part,

	((k) & 0xff00) == 0xf803

which is indeed always false.

We should have a better way to distinguish trees that came from
user source code and those that didn't.  The later shouldn't be
warned about.  This is not easy to fix, I think.  :-/


r~


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