mesa: 790ff232e2607a83e6207d06900a5e3de613d161 (master) This fragment shader triggers an assertion in the Mesa GLSL compiler. void A(bool a) { } void main() { A(0 == 1 == 2); gl_FragColor = vec4(0.0); } (gdb) bt #0 0x0054b416 in __kernel_vsyscall () #1 0x002d2941 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #2 0x002d5e42 in abort () at abort.c:92 #3 0x002cb8e8 in __assert_fail (assertion=0xca35cc "op[0]->type->base_type == op[1]->type->base_type", file=0xca3580 "ir_constant_expression.cpp", line=72, function=0xca3d00 "virtual ir_constant* ir_expression::constant_expression_value()") at assert.c:81 #4 0x00ae47a1 in ir_expression::constant_expression_value (this=0x954f0b8) at ir_constant_expression.cpp:72 #5 0x00bb7239 in process_parameters (instructions=0x975bc78, actual_parameters=0xbffefa84, parameters=0x9484354, state=0x947a110) at ast_function.cpp:48 #6 0x00bbaa1d in ast_function_expression::hir (this=0x9484328, instructions=0x975bc78, state=0x947a110) at ast_function.cpp:1198 #7 0x00ac3b4a in ast_expression_statement::hir (this=0x9484668, instructions=0x975bc78, state=0x947a110) at ast_to_hir.cpp:1701 #8 0x00ac3baa in ast_compound_statement::hir (this=0x9484978, instructions=0x975bc78, state=0x947a110) at ast_to_hir.cpp:1717 #9 0x00ac641d in ast_function_definition::hir (this=0x94849d8, instructions=0x9483208, state=0x947a110) at ast_to_hir.cpp:2971 #10 0x00abf1ef in _mesa_ast_to_hir (instructions=0x9483208, state=0x947a110) at ast_to_hir.cpp:85 #11 0x00abda16 in _mesa_glsl_compile_shader (ctx=0x940e628, shader=0x9479ff8) at program/ir_to_mesa.cpp:3109 #12 0x00a5f8b8 in compile_shader (ctx=0x940e628, shaderObj=1) at main/shaderapi.c:856 (gdb) frame 4 #4 0x00ae47a1 in ir_expression::constant_expression_value (this=0x954f0b8) at ir_constant_expression.cpp:72 72 assert(op[0]->type->base_type == op[1]->type->base_type); (gdb) print op[0]->type->base_type $1 = GLSL_TYPE_BOOL (gdb) print op[1]->type->base_type $2 = GLSL_TYPE_INT
The assertion is correct; the bug is in ast_to_hir. While it correctly detects and emits the type error (int vs. bool), it still goes ahead and generates the ir_binop_all_equal expression node...with operands of bad types. This triggers assertions in later code such as ir_constant_expression or ir_validate. This looks like the same root cause as 33314 (just a different opcode). In fact, it looks like many opcodes suffer from this problem.
commit 175829f1a8ab0df7594131cc569462e45c1974ec Author: Eric Anholt <eric@anholt.net> Date: Sat Apr 9 12:54:34 2011 -1000 glsl: When we've emitted a semantic error for ==, return a bool constant. This prevents later errors (including an assertion failure) from cascading the failure. Fixes invalid-equality-04.vert. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33303 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chad Versace <chad.versace@intel.com>
mesa: a9a02c8a39620515ec9fd0d774ce329cf67ecb4e (master) Verified fixed.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.