glsl2: Don't declare a variable called sig that shadows the other one
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Aug 2010 23:58:25 +0000 (16:58 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Aug 2010 23:58:25 +0000 (16:58 -0700)
Accidentally having a variable called 'sig' within an if-statement
cause the higher scope 'sig' to always be NULL.  As a result a new
function signature was created for a function definition even when one
already existed from a prototype declaration.

Fixes piglit test case glsl-function-prototype (bugzilla #29520).

src/glsl/ast_to_hir.cpp

index f14341c8f724e476951d30e219b683e3b15a851a..9d4448f89a83aec195f4ba2160c8ea6fe86d3973 100644 (file)
@@ -2128,7 +2128,7 @@ ast_function::hir(exec_list *instructions,
     */
    f = state->symbols->get_function(name);
    if (f != NULL) {
-      ir_function_signature *sig = f->exact_matching_signature(&hir_parameters);
+      sig = f->exact_matching_signature(&hir_parameters);
       if (sig != NULL) {
         const char *badvar = sig->qualifiers_match(&hir_parameters);
         if (badvar != NULL) {