Bug 7645

Summary: Condition always tests false
Product: xorg Reporter: Mike A. Harris <mharris>
Component: App/xkbcompAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: esigra
Version: 7.1 (2006.05)   
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 10101    

Description Mike A. Harris 2006-07-26 11:53:38 UTC
xkbcomp contains a bug detected by gcc:

compat.c:249: warning: comparison is always false due to limited range of data type

static Bool
AddGroupCompat(CompatInfo *info,unsigned group,GroupCompatInfo *newGC)
GroupCompatInfo *       gc;
unsigned                merge;

    merge= newGC->merge;
    gc= &info->groupCompat[group];
    if ((newGC->fileID<0)||       /* This is line 249 */
        ((gc->real_mods==newGC->real_mods)&&(gc->vmods==newGC->vmods))) {
        return True;
    if (((gc->fileID==newGC->fileID)&&(warningLevel>0))||(warningLevel>9)) {
        WARN1("Compat map for group %d redefined\n",group+1);
        ACTION1("Using %s definition\n",(merge==MergeAugment?"old":"new"));
    if (merge!=MergeAugment)
        *gc= *newGC;
    return True;

The "if ((newGC->fileID<0)" test is always false because the fileID member
of the GroupCompatInfo struct is an unsigned char, so it can never be less
than zero.
Comment 1 Daniel Stone 2007-02-27 01:33:00 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Adam Jackson 2008-02-29 12:32:53 UTC
Fixed in git, thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.