[Mesa-dev] [PATCH] nv50: use larger arrays to silence warnings

Christoph Bumiller e0425955 at student.tuwien.ac.at
Wed Feb 1 07:14:12 PST 2012


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 ...

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, 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 ...

>
> -Brian
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list