Bug 34198 - [GLSL] implicit sized array with index 0 used gets assertion
Summary: [GLSL] implicit sized array with index 0 used gets assertion
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 7.10
Hardware: All Linux (All)
: high major
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2011-02-11 19:00 UTC by Gordon Jin
Modified: 2011-06-01 18:27 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
new piglit test case (251 bytes, text/plain)
2011-02-11 19:01 UTC, Gordon Jin
Details

Description Gordon Jin 2011-02-11 19:00:16 UTC
I changed the test case mentioned in bug#33219 a bit, with a[0] used:
float a[];
a[0] = 0;

It catches a new bug:
shader_runner: program/ir_to_mesa.cpp:654: int type_size(const glsl_type*): Assertion `type->length > 0' failed.

#0  0xb7fff424 in __kernel_vsyscall ()
#1  0x42c0fd71 in raise () from /lib/libc.so.6
#2  0x42c1164a in abort () from /lib/libc.so.6
#3  0x42c08de8 in __assert_fail () from /lib/libc.so.6
#4  0xb7bc6377 in type_size (type=0x839e480) at program/ir_to_mesa.cpp:654
#5  0xb7bcc762 in ir_to_mesa_visitor::visit (this=0xbffff1d0, ir=0x839f060)
    at program/ir_to_mesa.cpp:1526
#6  0xb7be9e78 in ir_dereference_variable::accept (this=0x839f060,
    v=0xbffff1d0) at ir.h:1402
#7  0xb7bcc877 in ir_to_mesa_visitor::visit (this=0xbffff1d0, ir=0x839f0f0)
    at program/ir_to_mesa.cpp:1548
#8  0xb7be9ec8 in ir_dereference_array::accept (this=0x839f0f0, v=0xbffff1d0)
    at ir.h:1440
#9  0xb7bcbaa2 in get_assignment_lhs (this=0xbffff1d0, ir=0x84191e8)
    at program/ir_to_mesa.cpp:1631
#10 ir_to_mesa_visitor::visit (this=0xbffff1d0, ir=0x84191e8)
    at program/ir_to_mesa.cpp:1732
#11 0xb7be9ca8 in ir_assignment::accept (this=0x84191e8, v=0xbffff1d0)
    at ir.h:677
#12 0xb7bcb2fc in ir_to_mesa_visitor::visit (this=0xbffff1d0, ir=0x857f748)
    at program/ir_to_mesa.cpp:941
#13 0xb7be9c28 in ir_function::accept (this=0x857f748, v=0xbffff1d0)
    at ir.h:510

It's regression. It passed with the mesa master on 2011-01-16 (when bug#33219 filed).
Comment 1 Gordon Jin 2011-02-11 19:01:51 UTC
Created attachment 43279 [details]
new piglit test case
Comment 2 Gordon Jin 2011-02-11 22:51:42 UTC
This is introduced by:

Commit: 5c2cec8337c5afc6941cd5c0bcedd27ff99b1bc7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c2cec8337c5afc6941cd5c0bcedd27ff99b1bc7

Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Jan 25 11:50:04 2011 -0800

ir_to_mesa: Add several assertions about sizes of arrays

Both of these assertions are triggered by the test case in bugzilla size of 0.
Comment 3 Ian Romanick 2011-02-15 18:24:12 UTC
This is fixed in master by the commit below.  I'll close the bug once the fix is cherry-picked to 7.9 and 7.10.

commit 25b36e8ff81a9c951085d6dd802a7534db476f5a
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Tue Feb 15 18:17:53 2011 -0800

    linker: Fix off-by-one error implicit array sizing
    
    Arrays are zero based.  If the highest element accessed is 6, the
    array needs to have 7 elements.
    
    Fixes piglit test glsl-fs-implicit-array-size-03 and bugzilla #34198.
    
    NOTE: This is a candidate for the 7.9 and 7.10 branches.
Comment 4 Gordon Jin 2011-02-23 00:06:54 UTC
verified it's fixed on master
Comment 5 Ian Romanick 2011-02-28 16:30:06 UTC
Fixed on 7.9 (7be5744b5b53f385c27ddbcec0b6bc6ecb394706) and 7.10 (52a274a4c04dba4354e2e84a4faceb994de646cf).
Comment 6 Gordon Jin 2011-06-01 18:27:54 UTC
verified on 7.10 branch


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.