Bug 57622 - Webgl conformance shader-with-non-reserved-words crash.
Webgl conformance shader-with-non-reserved-words crash.
Product: Mesa
Classification: Unclassified
Component: glsl-compiler
All All
: medium normal
Assigned To: Ian Romanick
Depends on:
  Show dependency treegraph
Reported: 2012-11-27 19:19 UTC by Pavel Ondračka
Modified: 2013-01-08 21:09 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Ondračka 2012-11-27 19:19:28 UTC
Last one of crashing webgl tests here on my GM45.

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/strlen.S:32
32		movdqu	(%rdi), %xmm1
(gdb) bt
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:32
#1  0x00007fffcc6966e6 in ralloc_strdup (ctx=0x7fffc7cc8630, str=
    0x4 <Address 0x4 out of bounds>) at ../../../src/glsl/ralloc.c:310
#2  0x00007fffcc672277 in ir_variable::ir_variable (this=0x7fffc7cc8630, type=
    0x0, name=<optimized out>, mode=<optimized out>)
    at ../../../src/glsl/ir.cpp:1491
#3  0x00007fffcc6a444b in _mesa_glsl_parse (state=0x7fffdcf11c50)
    at glsl_parser.yy:1595
#4  0x00007fffcc6b1845 in _mesa_glsl_compile_shader (ctx=ctx@entry=
    0x7fffdc366030, shader=shader@entry=0x7fffc7b53dc0)
    at ../../../src/mesa/program/ir_to_mesa.cpp:3074
#5  0x00007fffcc57034e in compile_shader (ctx=0x7fffdc366030, 
    shaderObj=<optimized out>) at ../../../src/mesa/main/shaderapi.c:723
#6  0x000000343b1db584 in ?? () from /usr/lib64/xulrunner/libxul.so
#7  0x000000343b8a8f7f in ?? () from /usr/lib64/xulrunner/libxul.so
#8  0x000000343b8a69c5 in ?? () from /usr/lib64/xulrunner/libxul.so
#9  0x00007fffeb1318d8 in ?? ()
#10 0x00007fffd9dfb938 in ?? ()
#11 0x0000000000000109 in ?? ()
#12 0x0000000000000000 in ?? ()

mesa: 9bc9895c4a608e475f241d2c16dc88e40ea702d7
Kernel: 3.6.7-4.fc17.x86_64
xf86-video-intel: 1367e3f9ef5f606c8927cbde441a2ea41fa6d025
libdrm: 171666e4b8127c17c68ea0d44cf4e81ec342f2d0
Firefox: 17.0
Comment 1 Pavel Ondračka 2012-11-27 19:22:26 UTC
Actually this one is also reproducible with swrast, reassigning. (glsl-compiler component is my best guess)
Comment 2 Ian Romanick 2012-11-28 01:18:33 UTC
This fails on current master and at least 8.0.4 (from my distro).

It looks like all of the failing cases have a structure that has a field with teh same name as the structure.  Even simple cases of this fail on Mesa's GLSL compiler:

struct S { vec4 S; };

attribute vec4 p;

void main() {
    S s;
    s.S = p;
    gl_Position = s.S;

Based on the error message, I think the structure name gets removed from the symbol table when the field name gets removed.  The error occurs at the declaration of s:

0:19(4): error: syntax error, unexpected NEW_IDENTIFIER, expecting ',' or ';'

I'll post a couple tests to the piglit mailing list shortly.
Comment 3 Ian Romanick 2012-12-06 22:58:02 UTC
A patch that should fix this bug has been posted to the Mesa mailing list:

Comment 4 Kenneth Graunke 2013-01-08 21:09:58 UTC
Fixed in master by:

commit ed3f237e09a42bdb55afb58d1536affad9000d76
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Dec 6 14:57:01 2012 -0800

    glsl: Don't add structure fields to the symbol table
    I erroneously added this back in January 2011 in commit 88421589.
    Looking at the commit message, I have no idea why I added it.  It only
    added non-array structure fields to the symbol table, so array structure
    fields are treated correctly.
    Fixes piglit tests structure-and-field-have-same-name.vert and
    structure-and-field-have-same-name-nested.vert.  It should also fix
    WebGL conformance tests shader-with-non-reserved-words.
    NOTE: This is a candidate for the stable release branches.
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57622
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>