Bug 7645 - Condition always tests false
Summary: Condition always tests false
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xkbcomp (show other bugs)
Version: 7.1 (2006.05)
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: xorg-7.4
  Show dependency treegraph
 
Reported: 2006-07-26 11:53 UTC by Mike A. Harris
Modified: 2008-02-29 12:32 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

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.