mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 02:00:12 +01:00
glsl: break out early if compound assignment's operand errored out
Fixes compiler crashes on:
struct Foo
{
float does_exist_member;
};
in vec2 tex;
out vec4 color;
void
main(void)
{
Foo foo;
foo.does_not_exist_member %= 3; /* or any of: <<=, >>=, &=, |=, ^= */
color = vec4(tex.xy, tex.xy);
}
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
CC: mesa-stable
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12717>
This commit is contained in:
parent
26302ccdc1
commit
30b2cc423c
1 changed files with 25 additions and 0 deletions
|
|
@ -1741,6 +1741,14 @@ ast_expression::do_hir(exec_list *instructions,
|
|||
op[0] = this->subexpressions[0]->hir(instructions, state);
|
||||
op[1] = this->subexpressions[1]->hir(instructions, state);
|
||||
|
||||
/* Break out if operand types were not parsed successfully. */
|
||||
if ((op[0]->type == glsl_type::error_type ||
|
||||
op[1]->type == glsl_type::error_type)) {
|
||||
error_emitted = true;
|
||||
result = ir_rvalue::error_value(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
orig_type = op[0]->type;
|
||||
type = modulus_result_type(op[0], op[1], state, &loc);
|
||||
|
||||
|
|
@ -1771,6 +1779,15 @@ ast_expression::do_hir(exec_list *instructions,
|
|||
this->subexpressions[0]->set_is_lhs(true);
|
||||
op[0] = this->subexpressions[0]->hir(instructions, state);
|
||||
op[1] = this->subexpressions[1]->hir(instructions, state);
|
||||
|
||||
/* Break out if operand types were not parsed successfully. */
|
||||
if ((op[0]->type == glsl_type::error_type ||
|
||||
op[1]->type == glsl_type::error_type)) {
|
||||
error_emitted = true;
|
||||
result = ir_rvalue::error_value(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
|
||||
&loc);
|
||||
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
|
||||
|
|
@ -1791,6 +1808,14 @@ ast_expression::do_hir(exec_list *instructions,
|
|||
op[0] = this->subexpressions[0]->hir(instructions, state);
|
||||
op[1] = this->subexpressions[1]->hir(instructions, state);
|
||||
|
||||
/* Break out if operand types were not parsed successfully. */
|
||||
if ((op[0]->type == glsl_type::error_type ||
|
||||
op[1]->type == glsl_type::error_type)) {
|
||||
error_emitted = true;
|
||||
result = ir_rvalue::error_value(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
orig_type = op[0]->type;
|
||||
type = bit_logic_result_type(op[0], op[1], this->oper, state, &loc);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue