mesa: add missing type check for function calls

(cherry picked from commit 001b1cbb0d)
This commit is contained in:
Brian Paul
2008-11-26 09:35:26 -07:00
committed by Brian Paul
parent e42ed1ed0b
commit aeb3caeba5
+15
View File
@@ -2025,6 +2025,21 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
return NULL;
}
/* type checking to be sure function's return type matches 'dest' type */
if (dest) {
slang_typeinfo t0;
slang_typeinfo_construct(&t0);
_slang_typeof_operation(A, dest, &t0);
if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) {
slang_info_log_error(A->log,
"Incompatible type returned by call to '%s'",
name);
return NULL;
}
}
n = _slang_gen_function_call(A, fun, oper, dest);
if (n && !n->Store && !dest