Bug 70368 - [Bisected] Ogles3 GL3Tests/uniform_buffer_object/uniform_buffer_object_arb_spec_example_for_std140 regressed
Summary: [Bisected] Ogles3 GL3Tests/uniform_buffer_object/uniform_buffer_object_arb_sp...
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: high major
Assignee: Paul Berry
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-11 09:42 UTC by fangxun
Modified: 2013-10-23 05:53 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description fangxun 2013-10-11 09:42:53 UTC
System Environment:
--------------------------
Arch:             x86_64
Platform:         Ivybridge
Libdrm:   (master)libdrm-2.4.46-46-gddbbdb13d80ea7f60e6f71356a444995b905366b
Mesa:    (master)a922d3413f99ec384ed23324a4cceade8ab57e34
Xf86_video_intel: (master)2.99.904-2-g97d809c26bec2c0120f2dc0bcfd840379bd996fa


Bug detailed description:
-------------------------
It segfault on mesa master branch. It works well on 9.2 branch.
GL3Tests/uniform_buffer_object/uniform_buffer_object_structure_and_array_element_names also segfaults.
Bisect shows f878d2060c196c8130af0912ffc4493c631b1c34 is the first bad commit.
commit f878d2060c196c8130af0912ffc4493c631b1c34
Author:     Paul Berry <stereotype441@gmail.com>
AuthorDate: Thu Sep 19 09:36:41 2013 -0700
Commit:     Paul Berry <stereotype441@gmail.com>
CommitDate: Wed Oct 9 16:49:38 2013 -0700

    glsl: Update ir_variable::max_ifc_array_access properly.

    This patch modifies update_max_array_access() so that it updates
    ir_variable::max_ifc_array_access to reflect the shader's use of
    arrays appearing within interface blocks.

    v2: Use an ordinary function in ast_array_index.cpp rather than a
    virtual function in ir_rvalue.  Avoid dereferencing NULL when handling
    accesses to ordinary structs.

Backtrace:
(#0  0x00007ffff5bbc9b5 in update_max_array_access (state=0x104b370, loc=0x7fffffffb820, idx=0, ir=0x106e0e0) at ../../../src/glsl/ast_array_index.cpp:78
#1  _mesa_ast_array_index_to_hir (mem_ctx=mem_ctx@entry=0x104b370, state=state@entry=0x104b370, array=0x106e0e0, idx=0x106e190, loc=..., idx_loc=...)
    at ../../../src/glsl/ast_array_index.cpp:166
#2  0x00007ffff5bc36ca in ast_expression::hir (this=0x108b560, instructions=0x7fffffffbc60, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1566
#3  0x00007ffff5bc441d in ast_expression::hir (this=0x108b6c0, instructions=0x7fffffffbc60, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1177
#4  0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x7fffffffbc60, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108b770,
    operand=operand@entry=1, operand_name=operand_name@entry=0x7ffff5c84b18 "RHS", error_emitted=error_emitted@entry=0x7fffffffbdbf) at ../../../src/glsl/ast_to_hir.cpp:931
#5  0x00007ffff5bc3b0d in ast_expression::hir (this=0x108b770, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1278
#6  0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108be20,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffc02f) at ../../../src/glsl/ast_to_hir.cpp:931
#7  0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108be20, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#8  0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108c560,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffc29f) at ../../../src/glsl/ast_to_hir.cpp:931
#9  0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108c560, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#10 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108d2d0,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffc50f) at ../../../src/glsl/ast_to_hir.cpp:931
#11 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108d2d0, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#12 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108e040,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffc77f) at ../../../src/glsl/ast_to_hir.cpp:931
#13 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108e040, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#14 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108e830,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffc9ef) at ../../../src/glsl/ast_to_hir.cpp:931
#15 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108e830, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#16 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108ef70,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffcc5f) at ../../../src/glsl/ast_to_hir.cpp:931
#17 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108ef70, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#18 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108f620,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffcecf) at ../../../src/glsl/ast_to_hir.cpp:931
#19 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108f620, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#20 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x108fcd0,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffd13f) at ../../../src/glsl/ast_to_hir.cpp:931
#21 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x108fcd0, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#22 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x1090410,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffd3af) at ../../../src/glsl/ast_to_hir.cpp:931
#23 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x1090410, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#24 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x1091180,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffd61f) at ../../../src/glsl/ast_to_hir.cpp:931
#25 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x1091180, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#26 0x00007ffff5bc2910 in get_scalar_boolean_operand (instructions=instructions@entry=0x109ac48, state=state@entry=0x104b370, parent_expr=parent_expr@entry=0x1091ef0,
    operand=operand@entry=0, operand_name=operand_name@entry=0x7ffff5c84b14 "LHS", error_emitted=error_emitted@entry=0x7fffffffd88f) at ../../../src/glsl/ast_to_hir.cpp:931
#27 0x00007ffff5bc3ae6 in ast_expression::hir (this=0x1091ef0, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1276
#28 0x00007ffff5bc6f55 in ast_selection_statement::hir (this=0x1046180, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:3872
#29 0x00007ffff5bc497f in ast_compound_statement::hir (this=0x10921e0, instructions=0x109ac48, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:1712
#30 0x00007ffff5bc69ef in ast_function_definition::hir (this=0x1092260, instructions=<optimized out>, state=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:3691
#31 0x00007ffff5bc1c20 in _mesa_ast_to_hir (instructions=0xf73b30, state=state@entry=0x104b370) at ../../../src/glsl/ast_to_hir.cpp:93
#32 0x00007ffff5be991e in _mesa_glsl_compile_shader (ctx=ctx@entry=0x7ffff552e040, shader=shader@entry=0x104b1d0, dump_ast=dump_ast@entry=false, dump_hir=dump_hir@entry=false)
    at ../../../src/glsl/glsl_parser_extras.cpp:1482
#33 0x00007ffff5abeaa4 in compile_shader (ctx=0x7ffff552e040, shaderObj=<optimized out>) at ../../../src/mesa/main/shaderapi.c:772
#34 0x000000000067b67b in initProgram (program=1,
    vertShaderCode=0x1046a60 "#version 300 es", ' ' <repeats 35 times>, "\n#ifdef GL_ARB_uniform_buffer_object", ' ' <repeats 15 times>, "\n#extension GL_ARB_uniform_buffer_object: require  \n#endif", ' ' <repeats 41 times>...,


Reproduce steps:
----------------
1. xinit
2. ./GTF -width=64 -height=64 -run=/GFX/Test/Ogles3conform/ogles3conform/GTF_ES/glsl/GTF/GL3Tests/uniform_buffer_object/uniform_buffer_object_arb_spec_example_for_std140.test
Comment 1 Paul Berry 2013-10-14 22:56:27 UTC
I've reproduced the failure and I have some theories as to what might be going wrong.  I'll update the bug when I have a full diagnosis.
Comment 2 Paul Berry 2013-10-15 18:09:11 UTC
Patch sent to mailing list for review: http://lists.freedesktop.org/archives/mesa-dev/2013-October/046444.html
Comment 3 Paul Berry 2013-10-17 19:06:22 UTC
Fixed by commit e2d1eaa32a83204646bcccc029fdd31dbaee6d5e
Author: Paul Berry <stereotype441@gmail.com>
Date:   Tue Oct 15 09:43:22 2013 -0700

    glsl: In update_max_array_access, fix interface instance check.
    
    In commit f878d20 (glsl: Update ir_variable::max_ifc_array_access
    properly), I accidentally used the wrong kind of check to determine
    whether the variable being accessed was an interface instance (I used
    var->get_interface_type() != NULL when I should have used
    var->is_interface_instance()).  As a result, if an unnamed interface
    block contained a struct which contained an array,
    update_max_array_access() would mistakenly interpret the struct as a
    named interface block and try to dereference a null
    var->max_ifc_array_access.
    
    This patch corrects the check, fixing the null dereference.
    
    Fixes piglit test interface-block-struct-nesting.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70368
    
    Reviewed-by: Matt Turner <mattst88@gmail.com>
Comment 4 lu hua 2013-10-23 05:53:08 UTC
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.