Mesa (7.11): glsl: Don't use base type for bit-not when there's an error

Ian Romanick idr at kemper.freedesktop.org
Wed Jan 4 20:45:40 UTC 2012


Module: Mesa
Branch: 7.11
Commit: 7722a54e60c9da080b557d6596e4c9d363ead515
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7722a54e60c9da080b557d6596e4c9d363ead515

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Dec 23 17:16:43 2011 -0800

glsl: Don't use base type for bit-not when there's an error

Other parts of the compiler assume that expressions will have
well-formed types or the error type.  Just using the type of the thing
being operated on can cause expressions like ~3.14 or ~false to not
have a well-formed type.  This could then result in an assertion
failure in the context epxression handler.

If there is an error processing the expression, set the type of the IR
expression to error.

Fixes piglit's bit-not-0[789].frag tests.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Vinson Lee <vlee at vmware.com>
(cherry picked from commit 39464489510270bbe472d11f7614c04ce1b6ae33)

---

 src/glsl/ast_to_hir.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 2289047..1650978 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1140,7 +1140,7 @@ ast_expression::hir(exec_list *instructions,
 	 error_emitted = true;
       }
 
-      type = op[0]->type;
+      type = error_emitted ? glsl_type::error_type : op[0]->type;
       result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL);
       break;
 




More information about the mesa-commit mailing list