Mesa (master): tgsi: move register checking code before check_register_usage()

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 7 10:21:06 PST 2010


Module: Mesa
Branch: master
Commit: 16b5d2eba3b5ccb56c26c0d1c66763f99f1ad191
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16b5d2eba3b5ccb56c26c0d1c66763f99f1ad191

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jan  7 10:54:56 2010 -0700

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 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 9b06444..3a8cb49 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]");
-         }
       }
    }
 



More information about the mesa-commit mailing list