[Mesa-dev] [PATCH 02/12] glsl/ast: don't accept function calls as constructors.

Dave Airlie airlied at gmail.com
Mon May 23 00:52:32 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This fixes a crash in
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/compiler/glsl/ast_function.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 6c12565..ee7fda2 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -2041,7 +2041,10 @@ ast_function_expression::hir(exec_list *instructions,
       process_parameters(instructions, &actual_parameters, &this->expressions,
 			 state);
 
-      if (id->oper == ast_array_index) {
+      if (id->oper == ast_function_call) {
+         _mesa_glsl_error(& loc, state, "function call cannot be used as a constructor\n");
+	 return ir_rvalue::error_value(ctx);
+      } else if (id->oper == ast_array_index) {
          array_idx = generate_array_index(ctx, instructions, state, loc,
                                           id->subexpressions[0],
                                           id->subexpressions[1], &func_name,
-- 
2.5.5



More information about the mesa-dev mailing list