Bug 40207

Summary: Tautological comparison in explicit attribute location code
Product: Mesa Reporter: Kenneth Graunke <kenneth>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Kenneth Graunke 2011-08-18 14:00:47 UTC
commit 68a4fc9d5a9dd3b61472451d659275531253b67d
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Oct 7 17:21:22 2010 -0700

    glsl: Add linker support for explicit attribute locations

introduces the line "if (qual->location >= 0) {".  Unfortunately, qual->location is unsigned, so the else clause will never run.  Presumably something is wrong here.  Found with clang.
Comment 1 Ian Romanick 2011-12-22 17:03:10 UTC
Fixed on the 7.11 branch by:

commit 42d1a7b3de0907945a09ecc797afb01450da321e
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Sun Aug 21 15:44:35 2011 -0700

    glsl: Silence "ast_to_hir.cpp:1984:25: warning: comparison of unsigned expression >= 0 is always true"
    
    ast_type_qualifier::location should have been a signed integer from
    the beginning, and the giant comment in
    apply_type_qualifier_to_variable explains why.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40207
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit f0dd21ac88c0ee0a7dd96012881deeb3172974b6)

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.