Mesa (7.10): glsl: Function signatures cannot have NULL return type

Ian Romanick idr at kemper.freedesktop.org
Thu Mar 24 20:39:45 UTC 2011


Module: Mesa
Branch: 7.10
Commit: 9dec904ef36faa3356d6a01f82a60cf8ce39aea6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9dec904ef36faa3356d6a01f82a60cf8ce39aea6

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Mar  7 15:08:22 2011 -0800

glsl: Function signatures cannot have NULL return type

The return type can be void, and this is the case where a `_ret_val'
variable should not be declared.
(cherry picked from commit 2df56b002dcc5d7e91515bd0ca741677f0172b38)

---

 src/glsl/ir_validate.cpp           |    6 ++++++
 src/glsl/opt_function_inlining.cpp |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 44d7549..5e491db 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -198,6 +198,12 @@ ir_validate::visit_enter(ir_function_signature *ir)
       abort();
    }
 
+   if (ir->return_type == NULL) {
+      printf("Function signature %p for function %s has NULL return type.\n",
+	     ir, ir->function_name());
+      abort();
+   }
+
    this->validate_ir(ir, this->data);
 
    return visit_continue;
diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp
index a0449a7..2c49935 100644
--- a/src/glsl/opt_function_inlining.cpp
+++ b/src/glsl/opt_function_inlining.cpp
@@ -126,7 +126,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
    parameters = new ir_variable *[num_parameters];
 
    /* Generate storage for the return value. */
-   if (this->callee->return_type) {
+   if (!this->callee->return_type->is_void()) {
       retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val",
 				    ir_var_auto);
       next_ir->insert_before(retval);




More information about the mesa-commit mailing list