[Mesa-dev] [PATCH] nv50: use larger arrays to silence warnings
Brian Paul
brianp at vmware.com
Wed Feb 1 07:21:41 PST 2012
On 02/01/2012 08:14 AM, Christoph Bumiller wrote:
> On 01.02.2012 15:23, Brian Paul wrote:
>> On 02/01/2012 03:40 AM, Jose Fonseca wrote:
>>> Silences warnings and fixes potential bugs due to buffer overflow.
>>>
>>> The nv50 maintainers could benefit from sprinkling a few asserts to
>>> catch this early in the future, as it is bound to happen again.
>>
>> Good point. I'll add a couple asserts.
>
> Hm, I don't see any assertions in the commit ...
Grrr, I forgot to fold them into the commit before pushing. I'll push
them soon.
>
> I should really have used something like NV50_MAX_INSN_SRCS in the loop
> in the old code there (nv50_pc_regalloc), but it's scheduled for removal
> anyway ...
>
> As for the optimization pass, I don't see how the compiler can
> statically determine that the array will overflow,
I was a bit surprised to see the compiler figure that out too.
> and it wasn't
> supposed to (maximum store size is 16 bytes, and minimum size of a Value
> (with TGSI input) is 4 bytes, makes 4 Values.
>
> But you're right I should have been more careful with that code, it's
> ... been written at a point where I just wanted to be done with it (but
> still include enough optimizations so as to not produce worse code than
> the old solution).
>
> Thanks for fixing, Christoph
>
> hm, I need to make my compiler spit out better/more warnings ...
Do you want to cherry-pick these fixes to 8.0?
-Brian
More information about the mesa-dev
mailing list