From: Brian Paul Date: Thu, 7 Jan 2010 17:54:56 +0000 (-0700) Subject: tgsi: move register checking code before check_register_usage() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16b5d2eba3b5ccb56c26c0d1c66763f99f1ad191;p=mesa.git tgsi: move register checking code before check_register_usage() check_register_usage() frees the scan_register *reg data so we were reading from freed memory. This fixes a valgrind error found with piglit's glsl-vs-mov-after-deref test. --- diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 9b0644465af..3a8cb498d2a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -333,15 +333,15 @@ iter_instruction( fill_scan_register1d(ind_reg, inst->Src[i].Indirect.File, inst->Src[i].Indirect.Index); + if (!(reg->file == TGSI_FILE_ADDRESS || reg->file == TGSI_FILE_LOOP) || + reg->indices[0] != 0) { + report_warning(ctx, "Indirect register neither ADDR[0] nor LOOP[0]"); + } check_register_usage( ctx, reg, "indirect", FALSE ); - if (!(reg->file == TGSI_FILE_ADDRESS || reg->file == TGSI_FILE_LOOP) || - reg->indices[0] != 0) { - report_warning(ctx, "Indirect register neither ADDR[0] nor LOOP[0]"); - } } }