Bug 58039 - src/glsl/ralloc.c:81: get_header: Assertion `info->canary == 0x5A1106' failed.
Summary: src/glsl/ralloc.c:81: get_header: Assertion `info->canary == 0x5A1106' failed.
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Kenneth Graunke
QA Contact:
Keywords: have-backtrace, regression
Depends on:
Reported: 2012-12-09 04:04 UTC by Vinson Lee
Modified: 2012-12-17 19:37 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:

attempted fix. (2.05 KB, patch)
2012-12-16 01:48 UTC, Dave Airlie
Details | Splinter Review

Description Vinson Lee 2012-12-09 04:04:58 UTC
mesa: bd87441ac028068f422e2c96b39f93644a0f246f

Run piglit layout11.frag test.

$ ./bin/glslparsertest tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag fail
glslparsertest: src/glsl/ralloc.c:81: get_header: Assertion `info->canary == 0x5A1106' failed.

(gdb) bt
#0  0x00007f95dbb6a425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f95dbb6db8b in __GI_abort () at abort.c:91
#2  0x00007f95dbb630ee in __assert_fail_base (fmt=<optimized out>, 
    assertion=0x7f95da487512 "info->canary == 0x5A1106", file=0x7f95da487500 "src/glsl/ralloc.c", 
    line=<optimized out>, function=<optimized out>) at assert.c:94
#3  0x00007f95dbb63192 in __GI___assert_fail (assertion=0x7f95da487512 "info->canary == 0x5A1106", 
    file=0x7f95da487500 "src/glsl/ralloc.c", line=81, 
    function=0x7f95da4875f8 <__PRETTY_FUNCTION__.4345> "get_header") at assert.c:103
#4  0x00007f95d9afe9fc in get_header (ptr=0x1909790) at src/glsl/ralloc.c:81
#5  0x00007f95d9afeabf in ralloc_size (ctx=0x1909790, size=33) at src/glsl/ralloc.c:112
#6  0x00007f95d9aff419 in ralloc_vasprintf (ctx=0x1909790, fmt=0x7f95da478f78 "whole array assignment forbidden", 
    args=0x7fff04da9358) at src/glsl/ralloc.c:419
#7  0x00007f95d9ac6f68 in _mesa_glsl_parse_state::check_version (this=0x195ab40, required_glsl_version=120, 
    required_glsl_es_version=300, locp=0x7fff04da94c0, fmt=0x7f95da478f78 "whole array assignment forbidden")
    at src/glsl/glsl_parser_extras.cpp:154
#8  0x00007f95d9abacfb in do_assignment (instructions=0x1991280, state=0x195ab40, non_lvalue_description=0x0, lhs=
    0x1991740, rhs=0x1991b10, is_initializer=false, lhs_loc=...) at src/glsl/ast_to_hir.cpp:694
#9  0x00007f95d9abb9cc in ast_expression::hir (this=0x1961320, instructions=0x1991280, state=0x195ab40)
    at src/glsl/ast_to_hir.cpp:1042
#10 0x00007f95d9abeba2 in ast_expression_statement::hir (this=0x195d230, instructions=0x1991280, state=0x195ab40)
    at src/glsl/ast_to_hir.cpp:1806
#11 0x00007f95d9ac3c84 in ast_iteration_statement::hir (this=0x19613d0, instructions=0x1990b58, state=0x195ab40)
    at src/glsl/ast_to_hir.cpp:3863
#12 0x00007f95d9abec0a in ast_compound_statement::hir (this=0x1961460, instructions=0x1990b58, state=0x195ab40)
    at src/glsl/ast_to_hir.cpp:1822
#13 0x00007f95d9ac233b in ast_function_definition::hir (this=0x195d1c0, instructions=0x195b5e0, state=0x195ab40)
    at src/glsl/ast_to_hir.cpp:3354
#14 0x00007f95d9ab9a4d in _mesa_ast_to_hir (instructions=0x195b5e0, state=0x195ab40) at src/glsl/ast_to_hir.cpp:91
#15 0x00007f95d995c3bc in _mesa_glsl_compile_shader (ctx=0x1909790, shader=0x195a4d0)
    at src/mesa/program/ir_to_mesa.cpp:3081
#16 0x00007f95d99175c0 in compile_shader (ctx=0x1909790, shaderObj=1) at src/mesa/main/shaderapi.c:717
#17 0x00007f95d9917e68 in _mesa_CompileShader (shaderObj=1) at src/mesa/main/shaderapi.c:1003
#18 0x00007f95dc15dd23 in stub_glCompileShader (shader=1)
    at piglit/tests/util/generated_dispatch.c:3113
#19 0x00000000004018d7 in test () at piglit/tests/glslparsertest/glslparsertest.c:203
#20 0x0000000000401efb in piglit_init (argc=3, argv=0x7fff04da9d18)
    at piglit/tests/glslparsertest/glslparsertest.c:373
#21 0x00007f95dc1575c9 in run_test (gl_fw=0x7f95dc420800 <glut_fw>, argc=3, argv=0x7fff04da9d18)
    at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:125
#22 0x00007f95dc1556ed in piglit_gl_test_run (argc=3, argv=0x7fff04da9d18, config=0x7fff04da9c00)
    at piglit/tests/util/piglit-framework-gl.c:127
#23 0x000000000040163c in main (argc=3, argv=0x7fff04da9d18)
    at piglit/tests/glslparsertest/glslparsertest.c:81

0d9bba6e43ab45c8eb758b4e29f4ed085a9398c9 is the first bad commit
commit 0d9bba6e43ab45c8eb758b4e29f4ed085a9398c9
Author: Paul Berry <stereotype441@gmail.com>
Date:   Sun Aug 5 09:57:01 2012 -0700

    glsl: Make use of new _mesa_glsl_parse_state::check_version() function.
    Previous to this patch, we were not very consistent about the errors
    we generate when a shader tried to use a feature that is prohibited in
    the current GLSL version.  Some error messages failed to mention the
    GLSL version currently in use (or did so inaccurately), and some error
    messages failed to mention the first GLSL version in which the given
    feature is allowed.
    This patch reworks all of the error checks to use the check_version()
    function, which produces error messages in a standard form
    (approximately "$FEATURE forbidden in $CURRENT_GLSL_VERSION
    ($REQUIRED_GLSL_VERSION required).").
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Acked-by: Carl Worth <cworth@cworth.org>

:040000 040000 018da8e8de73f8e9ca63ee614cb313178b6d92ab 95983fc2094453ce6ff90b613150455b3ad9375b M	src
bisect run success
Comment 1 Bruno Jacquet (Xaapyks) 2012-12-14 20:49:27 UTC
I'm experiencing this too. (Running Heroes of Newerth)
Comment 2 Bruno Jacquet (Xaapyks) 2012-12-14 21:06:07 UTC
Though I bisected it to :
df87722beccf0255d149668ca54a35cabf99a9c4 is the first bad commit
commit df87722beccf0255d149668ca54a35cabf99a9c4
Author: Paul Berry <stereotype441@gmail.com>
Date:   Sun Dec 9 20:59:26 2012 -0800

    glsl/linker: Pack within compound varyings.
    This patch implements varying packing within varyings that are
    composed of multiple vectors of size less than 4 (e.g. arrays of
    vec2's, or matrices with height less than 4).
    Previously, such varyings used up a full 4-wide varying slot for each
    constituent vector, meaning that some of the components of each
    varying slot went unused.  For example, a mat4x3 would be stored as
     <----slot1----> <----slot2----> <----slot3----> <----slot4---->  slots
      *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
     <-column1->  x  <-column2->  x  <-column3->  x  <-column4->  x   matrix
    (Each * represents a varying component, and the "x"s represent wasted
    space).  In addition to wasting precious varying components, this
    layout complicated transform feedback, since the constituents of the
    varying are expected to be output to the transform feedback buffer
    contiguously (e.g. without gaps between the columns, in the case of a
    This change packs the constituents of each varying together so that
    all wasted space is at the end.  For the mat4x3 example, this looks
    like so:
     <----slot1----> <----slot2----> <----slot3----> <----slot4---->  slots
      *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
     <-column1-> <-column2-> <-column3-> <-column4->  x   x   x   x   matrix
    Note that matrix columns 2 and 3 now cross a boundary between varying
    slots (a characteristic I call "double parking" of a varying).
    We don't bother trying to eliminate the wasted space at the end of the
    varying, since the patch that follows will take care of that.
    Since compiler back-ends don't (yet) support this packed layout, the
    lower_packed_varyings function is used to rewrite the shader into a
    form where each varying occupies a full varying slot.  Later, if we
    add native back-end support for varying packing, we can make this
    lowering pass optional.
    Reviewed-by: Eric Anholt <eric@anholt.net>
    v2: Skip varying packing if ctx->Const.DisableVaryingPacking is true.

:040000 040000 8fd42fe4c6d749ff87fcf9a72e8e45cdc03426c5 0b6864612065c45dc8f8feb24c0c2dbb3cd072bc M      src
Comment 3 Bruno Jacquet (Xaapyks) 2012-12-14 21:10:29 UTC
And it happens with and withoout the LLVM glsl compiler.
I'm using an HD6870 on Linux 3.7, libdrm 2.4.40 and ddx 3c7d024c2671dac541b8f2daed55040f4fd5d62d
Comment 4 Darxus 2012-12-15 16:25:07 UTC
This is breaking wayland / weston for me.  Reverting to the commit before Vinson's first bad commit works.  

Same error:

weston: ../../src/glsl/ralloc.c:81: get_header: Assertion `info->canary == 0x5A1106' failed.
Comment 5 Ian Romanick 2012-12-15 22:27:35 UTC
Paul, can you do some checking with Valgrind?
Comment 6 Dave Airlie 2012-12-16 01:48:18 UTC
Created attachment 71572 [details] [review]
attempted fix.
Comment 7 Darxus 2012-12-16 02:12:48 UTC
Dave:  Looks like that worked - weston is running with the latest mesa commit ( 4f91f8dd6057b73d05454fc626985183d00e5236 ) plus your patch.  Beyond that, I'm in no position to say.
Comment 8 Dave Airlie 2012-12-16 07:30:06 UTC
pushing fix after testing and review. reopen if seen again or file a new bug for a different backtrace.
Comment 9 Vinson Lee 2012-12-16 23:45:32 UTC
mesa: fa5078c255b5b57514ae854ecd6264379641c924 (master)

I still see still crash with piglit layout11.frag on swrast, softpipe, and llvmpipe.
Comment 10 Darxus 2012-12-17 00:11:27 UTC
FYI weston is working for me with that same mesa commit ( fa5078c255b5b57514ae854ecd6264379641c924 ).
Comment 11 Kenneth Graunke 2012-12-17 19:37:05 UTC
commit 12f3b3d43732b6f9dbed72457a75b131ad621793
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Dec 17 11:20:53 2012 -0800

    glsl: Fix gl_context vs. ralloc context in check_version again, again.
    Dave found some, but there were more.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58039

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.