Skip to content
Snippets Groups Projects
Commit 7b9ebf87 authored by Renaud Gaubert's avatar Renaud Gaubert Committed by Samuel Iglesias Gonsálvez
Browse files

glsl: avoid compiler's segfault when processing operators with void arguments

This is done by returning an rvalue of type void in the
ast_function_expression::hir function instead of a void expression.

This produces (in the case of the ternary) an hir with a call
to the void returning function and an assignment of a void variable
which will be optimized out (the assignment) during the optimization
pass.

This fix results in having a valid subexpression in the many
different cases where the subexpressions are functions whose
return values are void.

Thus preventing to dereference NULL in the following cases:
  * binary operator
  * unary operators
  * ternary operator
  * comparison operators (except equal and nequal operator)

Equal and nequal had to be handled as a special case because
instead of segfaulting on a forbidden syntax it was now accepting
expressions with a void return value on either (or both) side of
the expression.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85252



Signed-off-by: default avatarRenaud Gaubert <renaud@lse.epita.fr>
Reviewed-by: default avatarGabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
parent 779cabfc
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment