Mesa (glsl2): glsl2: Fix storing of dead memory in the symbol table.

Ian Romanick idr at kemper.freedesktop.org
Wed Jun 30 13:56:40 PDT 2010


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Jun 30 11:57:43 2010 -0700

glsl2: Fix storing of dead memory in the symbol table.

decl->identifier is part of the AST, so it doesn't live very long.
Instead, add var->name which is owned by var.

---

 src/glsl/ast_to_hir.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 53f17de..a0ca7e5 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1851,7 +1851,7 @@ ast_declarator_list::hir(exec_list *instructions,
 			  "const declaration of `%s' must be initialized");
       }
 
-      /* Add the vairable to the symbol table after processing the initializer.
+      /* Add the variable to the symbol table after processing the initializer.
        * This differs from most C-like languages, but it follows the GLSL
        * specification.  From page 28 (page 34 of the PDF) of the GLSL 1.50
        * spec:
@@ -1861,7 +1861,7 @@ ast_declarator_list::hir(exec_list *instructions,
        *     being declared if not."
        */
       const bool added_variable =
-	 state->symbols->add_variable(decl->identifier, var);
+	 state->symbols->add_variable(var->name, var);
       assert(added_variable);
    }
 



More information about the mesa-commit mailing list