From 16b5d2eba3b5ccb56c26c0d1c66763f99f1ad191 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Jan 2010 10:54:56 -0700 Subject: [PATCH] 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. --- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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]"); - } } } -- 2.30.2