Bug 105183 - Weird assertion in NIR linker
Summary: Weird assertion in NIR linker
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-21 02:19 UTC by Ian Romanick
Modified: 2018-03-05 23:52 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Ian Romanick 2018-02-21 02:19:25 UTC
GCC issues the following warning in my build:

In file included from ../../SOURCE/master/src/compiler/glsl_types.h:29:0,
                 from ../../SOURCE/master/src/compiler/nir_types.h:36,
                 from ../../SOURCE/master/src/compiler/nir/nir.h:39,
                 from ../../SOURCE/master/src/compiler/nir/nir_linking_helpers.c:24:
../../SOURCE/master/src/compiler/nir/nir_linking_helpers.c: In function ‘remap_slots_and_components’:
../../SOURCE/master/src/compiler/nir/nir_linking_helpers.c:286:63: warning: ordered comparison of pointer with integer zero [-Wextra]
          assert(remap[var->data.location - VARYING_SLOT_VAR0] >= 0);
                                                               ^

I looked at the code, and remap is declared as "struct varying_loc (*remap)[4]".  It is comparing that a pointer to an array of 4 structures is >= 0.  I'm not sure what the original intention was, but this tautology isn't doing it.
Comment 1 Timothy Arceri 2018-03-05 23:52:55 UTC
Fixed by:

author	Timothy Arceri <tarceri@itsqueeze.com>
committer Timothy Arceri <tarceri@itsqueeze.com>
commit	cdeac002677774b14b78bb234aa082bbc499f933

nir: remove old assert

This was originally intended to make sure the remap location
was not -1. However the code has changed alot since then,
the location is now never set to -1 and we also handle
components meaning this old assert has been doing comparisons
with the pointer to the array of component data.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105183


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.