glsl: Fix lower_named_interface_blocks to account for dereferences of consts.

In certain rare cases (such as those involving dereference of a
literal constant array of structs),
flatten_named_interface_blocks_declarations's rvalue visitor may be
invoked on an ir_dereference_record whose variable_referenced() method
returns NULL.

Check for this case to avoid a segfault.

Prevents crashes in piglit tests
{vs,fs}-deref-literal-array-of-structs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Paul Berry 2013-07-14 08:57:49 -07:00
parent b2265db8e7
commit 428e030210
1 changed files with 2 additions and 0 deletions

View File

@ -194,6 +194,8 @@ flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
return;
ir_variable *var = ir->variable_referenced();
if (var == NULL)
return;
if (!var->is_interface_instance())
return;