Mesa (master): glsl: Initialize the rest of values of ir_constant::value.

Vinson Lee vlee at kemper.freedesktop.org
Sun Aug 29 06:57:59 UTC 2010


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

Author: Vinson Lee <vlee at vmware.com>
Date:   Sat Aug 28 23:55:51 2010 -0700

glsl: Initialize the rest of values of ir_constant::value.

Fixes valgrind uninitialized value errors in the piglit shader tests for
softpipe and llvmpipe.

---

 src/glsl/ir.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 8779ec7..d56b603 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -326,6 +326,9 @@ ir_constant::ir_constant(float f)
    this->ir_type = ir_type_constant;
    this->type = glsl_type::float_type;
    this->value.f[0] = f;
+   for (int i = 1; i < 16; i++)  {
+      this->value.f[i] = 0;
+   }
 }
 
 ir_constant::ir_constant(unsigned int u)
@@ -333,6 +336,9 @@ ir_constant::ir_constant(unsigned int u)
    this->ir_type = ir_type_constant;
    this->type = glsl_type::uint_type;
    this->value.u[0] = u;
+   for (int i = 1; i < 16; i++) {
+      this->value.u[i] = 0;
+   }
 }
 
 ir_constant::ir_constant(int i)
@@ -340,6 +346,9 @@ ir_constant::ir_constant(int i)
    this->ir_type = ir_type_constant;
    this->type = glsl_type::int_type;
    this->value.i[0] = i;
+   for (int i = 1; i < 16; i++) {
+      this->value.i[i] = 0;
+   }
 }
 
 ir_constant::ir_constant(bool b)
@@ -347,6 +356,9 @@ ir_constant::ir_constant(bool b)
    this->ir_type = ir_type_constant;
    this->type = glsl_type::bool_type;
    this->value.b[0] = b;
+   for (int i = 1; i < 16; i++) {
+      this->value.b[i] = false;
+   }
 }
 
 ir_constant::ir_constant(const ir_constant *c, unsigned i)




More information about the mesa-commit mailing list