st_glsl_to_tgsi: don't read potentially uninitialized buffer variable
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 13 May 2016 06:56:44 +0000 (01:56 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 15 Jun 2016 07:27:40 +0000 (09:27 +0200)
Found by -fsanitize=undefined. Note that this should be a harmless issue in
practice because the inst->op check always dominates anyway.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index b7eaa13ffb236d8e0ae6f85eda57af952a35f90f..8c6fe79d832537e093a2e53f7b5b45f310d34a90 100644 (file)
@@ -3334,7 +3334,7 @@ glsl_to_tgsi_visitor::visit_ssbo_intrinsic(ir_call *ir)
       inst = (glsl_to_tgsi_instruction *)inst->get_prev();
       if (inst->op == TGSI_OPCODE_UADD)
          inst = (glsl_to_tgsi_instruction *)inst->get_prev();
-   } while (inst && inst->buffer.file == PROGRAM_UNDEFINED && inst->op == op);
+   } while (inst && inst->op == op && inst->buffer.file == PROGRAM_UNDEFINED);
 }
 
 void