On Wed, Nov 25, 2015 at 2:48 PM, Matt Turner <[email protected]> wrote:
> The code seems fine to me. Here's what I see:
>
> We start with remaining_channels = WRITEMASK_XYZW. We initialize an
> element of imm[] for each enabled bit of inst->dst.writemask, and then
> we disable those bits from remaining_channels. When remaining_channels
> is zero (should be if and only if all elements of imm[] are
> initialized), we read imm[].
>
> Do you see anything wrong or anything I've missed?
>
> FWIW, Clang does not warn about this and doesn't warn if I remove the
> useless initializations of remaining_channels = 0 and inst_count = 0.
> I think this is gcc and Coverity just being stupid.
The attached file reproduces what I'm claiming is a gcc deficiency.
gcc-4.9.3 and gcc-5.2.0 will warn about data0 being uninitialized when
using -Wall. Clang does not.
I'll file a gcc bug.
#define X (1 << 0)
void bar(unsigned data);
void foo(unsigned writemask, unsigned data) {
unsigned remaining = X;
unsigned data0;
if (writemask & X) data0 = data;
remaining &= ~writemask;
if (remaining == 0)
//if (writemask & X)
bar(data0);
}
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev