summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-07 10:54:56 -0700
committerBrian Paul <[email protected]>2010-01-07 10:55:00 -0700
commit16b5d2eba3b5ccb56c26c0d1c66763f99f1ad191 (patch)
tree94e63105f30a93176dddb69d7e32520f83d20e38 /src
parentb841c2756e6d697d5b2884317c0daa3f176195a6 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c8
1 files 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]");
- }
}
}