[Mesa-dev] [PATCH] i965: quieten compiler warning about out-of-bounds access

Ilia Mirkin imirkin at alum.mit.edu
Thu Jan 7 11:14:47 PST 2016


On Thu, Jan 7, 2016 at 2:07 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Wed, Jan 6, 2016 at 11:03 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> On Tue, Jan 5, 2016 at 8:30 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>>>
>>> On Jan 4, 2016 8:30 PM, "Ilia Mirkin" <imirkin at alum.mit.edu> wrote:
>>>>
>>>> gcc 4.9.3 shows the following error:
>>>>
>>>> brw_vue_map.c:260:20: warning: array subscript is above array bounds
>>>> [-Warray-bounds]
>>>>     return brw_names[slot - VARYING_SLOT_MAX];
>>>>
>>>> This is because BRW_VARYING_SLOT_COUNT is a valid value for the enum
>>>> type. Adding an assert will generate no additional code but will teach
>>>> the compiler to not complain.
>>>
>>> What of you build in release mode?
>>
>> You get the warning :)
>
> That's usually the reason to use unreachable()

Well, I pushed this patch shortly after Timothy R-b'd it. Let me know
if you'd like me to push a revert.

  -ilia


More information about the mesa-dev mailing list