[Mesa-dev] [PATCH v2 2/3] nouveau: Fix a couple of "foo may be used uninitialized' compiler warnings

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jun 29 13:42:33 UTC 2016



On 06/29/2016 03:33 PM, Ilia Mirkin wrote:
> Since you're the 75th person to send these, I'm going to break down
> and say "fine, whtvr". I really hate this "pander to stupid compilers"
> things. If the warning is wrong, my natural inclination would be to
> disable it (after my even more natural inclination to ignore it). But
> sticking 0's in all over the place unnecessarily isn't the worst thing
> in the world either.

I'm not surprised by your answer.

But yeah, if that compiler "warning" is not "fixed", I bet that someone 
else will send *exactly* the same patch in the next weeks/months. :)

>
> Acked-by: Ilia Mirkin <imirkin at alum.mit.edu>
>
> On Wed, Jun 29, 2016 at 8:38 AM, Hans de Goede <hdegoede at redhat.com> wrote:
>> These are all new false positives with gcc6.
>>
>> In nouveau_compiler.c: gcc6 no longer assumes that passing a pointer
>> to a variable into a function initialises that variable.
>>
>> In nv50_ir_from_tgsi.cpp op and mode are not set if there are 0
>> enabled dst channels, this never happens, but gcc cannot know this.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 4 ++--
>>  src/gallium/drivers/nouveau/nouveau_compiler.c            | 2 +-
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> index 7695511..a22fc0e 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
>> @@ -2747,8 +2747,8 @@ Converter::handleINTERP(Value *dst[4])
>>     Value *offset = NULL, *ptr = NULL, *w = NULL;
>>     Symbol *sym[4] = { NULL };
>>     bool linear;
>> -   operation op;
>> -   int c, mode;
>> +   operation op = OP_NOP;
>> +   int c, mode = 0;
>>
>>     tgsi::Instruction::SrcRegister src = tgsi.getSrc(0);
>>
>> diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
>> index e00ad3f..d8009f5 100644
>> --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
>> +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
>> @@ -142,7 +142,7 @@ main(int argc, char *argv[])
>>     const char *filename = NULL;
>>     FILE *f;
>>     char text[65536] = {0};
>> -   unsigned size, *code;
>> +   unsigned size = 0, *code = NULL;
>>
>>     for (i = 1; i < argc; i++) {
>>        if (!strcmp(argv[i], "-a"))
>> --
>> 2.7.4
>>

-- 
-Samuel


More information about the mesa-dev mailing list