glsl: Function signatures cannot have NULL return type
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 7 Mar 2011 23:08:22 +0000 (15:08 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 8 Mar 2011 19:47:25 +0000 (11:47 -0800)
The return type can be void, and this is the case where a `_ret_val'
variable should not be declared.

src/glsl/ir_validate.cpp
src/glsl/opt_function_inlining.cpp

index 44d7549..5e491db 100644 (file)
@@ -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;
index 2e7831d..064089a 100644 (file)
@@ -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);