Bug 27921 - shader/slang/slang_codegen.c:4194: _slang_gen_variable: Assertion `var->declared' failed.
Summary: shader/slang/slang_codegen.c:4194: _slang_gen_variable: Assertion `var->decla...
Status: CLOSED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium critical
Assignee: Brian Paul
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-30 18:04 UTC by Vinson Lee
Modified: 2010-05-03 16:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vinson Lee 2010-04-30 18:04:54 UTC
mesa: f5a4d70189bdd8e25bc1f30b9f4fe8f31999cf0e (master)

Run piglit glsl2 function-08.frag test. This is a negative test case.

$ ./bin/glslparsertest tests/glslparsertest/glsl2/function-08.frag fail

glslparsertest: shader/slang/slang_codegen.c:4194: _slang_gen_variable: Assertion `var->declared' failed.

(gdb) bt
#0  0x0012d422 in __kernel_vsyscall ()
#1  0x005f44d1 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x005f7932 in *__GI_abort () at abort.c:92
#3  0x005ed648 in *__GI___assert_fail (assertion=0x442297 "var->declared", file=0x4410a2 "shader/slang/slang_codegen.c", line=4194, 
    function=0x44281f "_slang_gen_variable") at assert.c:81
#4  0x003bd0e6 in _slang_gen_variable (A=0xbfffde3c, oper=0xb6dcd624) at shader/slang/slang_codegen.c:4194
#5  0x003be67a in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcd624) at shader/slang/slang_codegen.c:4868
#6  0x003b919b in _slang_gen_asm (A=0xbfffde3c, oper=0xb6dcc2c4, dest=0x0) at shader/slang/slang_codegen.c:1917
#7  0x003be5e2 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcc2c4) at shader/slang/slang_codegen.c:4855
#8  0x003b8b61 in _slang_gen_function_call (A=0xbfffde3c, fun=0xb7454788, oper=0xb6dcc2c4, dest=0x0) at shader/slang/slang_codegen.c:1663
#9  0x003ba185 in _slang_gen_function_call_name (A=0xbfffde3c, name=0x44245c "+", oper=0xb6dcc2c4, dest=0x0)
    at shader/slang/slang_codegen.c:2455
#10 0x003be131 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcc2c4) at shader/slang/slang_codegen.c:4761
#11 0x003bd5b5 in _slang_gen_assignment (A=0xbfffde3c, oper=0xb6dcc1e0) at shader/slang/slang_codegen.c:4353
#12 0x003be30f in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcc1e0) at shader/slang/slang_codegen.c:4798
#13 0x003bdec2 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcb49c) at shader/slang/slang_codegen.c:4707
#14 0x003bbeed in _slang_gen_if (A=0xbfffde3c, oper=0xb6dcd0b8) at shader/slang/slang_codegen.c:3556
#15 0x003be691 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcd0b8) at shader/slang/slang_codegen.c:4870
#16 0x003be8aa in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dcb234) at shader/slang/slang_codegen.c:4917
#17 0x003be8aa in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc7e3c) at shader/slang/slang_codegen.c:4917
#18 0x003b8b61 in _slang_gen_function_call (A=0xbfffde3c, fun=0xb6dc5c5c, oper=0xb6dc7e3c, dest=0x0) at shader/slang/slang_codegen.c:1663
#19 0x003ba185 in _slang_gen_function_call_name (A=0xbfffde3c, name=0xb6dc3f30 "y_adjust", oper=0xb6dc7e3c, dest=0x0)
    at shader/slang/slang_codegen.c:2455
#20 0x003be60b in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc7e3c) at shader/slang/slang_codegen.c:4857
#21 0x003b919b in _slang_gen_asm (A=0xbfffde3c, oper=0xb6dc5bb4, dest=0x0) at shader/slang/slang_codegen.c:1917
#22 0x003be5e2 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc5bb4) at shader/slang/slang_codegen.c:4855
#23 0x003b8b61 in _slang_gen_function_call (A=0xbfffde3c, fun=0xb7454788, oper=0xb6dc5bb4, dest=0x0) at shader/slang/slang_codegen.c:1663
#24 0x003ba185 in _slang_gen_function_call_name (A=0xbfffde3c, name=0x44245c "+", oper=0xb6dc5bb4, dest=0x0)
    at shader/slang/slang_codegen.c:2455
#25 0x003be131 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc5bb4) at shader/slang/slang_codegen.c:4761
#26 0x003bd5b5 in _slang_gen_assignment (A=0xbfffde3c, oper=0xb6dc55e8) at shader/slang/slang_codegen.c:4353
#27 0x003be30f in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc55e8) at shader/slang/slang_codegen.c:4798
#28 0x003bdf32 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc5598) at shader/slang/slang_codegen.c:4722
#29 0x003bdec2 in _slang_gen_operation (A=0xbfffde3c, oper=0xb6dc5548) at shader/slang/slang_codegen.c:4707
#30 0x003bf59b in _slang_codegen_function (A=0xbfffde3c, fun=0xb6dc5ca8) at shader/slang/slang_codegen.c:5306
#31 0x002f7755 in parse_code_unit (C=0xbfffe044, unit=0xbfffe2f4, shader=0x8089098) at shader/slang/slang_compile.c:2636
#32 0x002f782f in compile_binary (prod=0x83a3528 "\005\002\002", unit=0xbfffe2f4, version=110, type=SLANG_UNIT_FRAGMENT_SHADER, 
    infolog=0xbffff31c, builtin=0xbfffe244, downlink=0xbfffe2c8, shader=0x8089098) at shader/slang/slang_compile.c:2679
#33 0x002f7bab in compile_with_grammar (
    source=0x838c778 "/* FAIL */\n/* NVIDIA - incompatible types in initialization */\n/* fglrx - Undeclared identifier x_adjust */\n/* Apple - 'x_adjust' : undeclared identifier */\n\n\nvarying vec4 pos;\n\nvec4 x_adjust(vec4 pos"..., unit=0xbfffe2f4, 
    type=SLANG_UNIT_FRAGMENT_SHADER, infolog=0xbffff31c, builtin=0xbfffe244, shader=0x8089098, pragmas=0x80890b8, shader_type=1, 
    parsing_builtin=0) at shader/slang/slang_compile.c:2786
#34 0x002f7eb2 in compile_object (
    source=0x838c778 "/* FAIL */\n/* NVIDIA - incompatible types in initialization */\n/* fglrx - Undeclared identifier x_adjust */\n/* Apple - 'x_adjust' : undeclared identifier */\n\n\nvarying vec4 pos;\n\nvec4 x_adjust(vec4 pos"..., object=0xbfffe244, 
    type=SLANG_UNIT_FRAGMENT_SHADER, infolog=0xbffff31c, shader=0x8089098, pragmas=0x80890b8) at shader/slang/slang_compile.c:2912
#35 0x002f8032 in _slang_compile (ctx=0x805c530, shader=0x8089098) at shader/slang/slang_compile.c:2964
#36 0x002aacbf in _mesa_compile_shader (ctx=0x805c530, shaderObj=1) at shader/shader_api.c:1509
#37 0x0036aee2 in _mesa_CompileShaderARB (shaderObj=1) at main/shaders.c:80
#38 0x08049e8b in display ()
#39 0x00504314 in processWindowWorkList (window=0x80598c8) at glut_event.c:1307
#40 0x00504427 in __glutProcessWindowWorkLists () at glut_event.c:1358
#41 0x0050449c in glutMainLoop () at glut_event.c:1379
#42 0x0804a156 in main ()

(gdb) frame 4
#4  0x003bd0e6 in _slang_gen_variable (A=0xbfffde3c, oper=0xb6dcd624) at shader/slang/slang_codegen.c:4194
4194	   assert(var->declared);
(gdb) print *var
$1 = {type = {qualifier = SLANG_QUAL_NONE, specifier = {type = SLANG_SPEC_VEC4, _struct = 0x0, _array = 0x0}, 
    precision = SLANG_PREC_DEFAULT, variant = SLANG_VARIANT, centroid = SLANG_CENTER, layout = SLANG_LAYOUT_NONE, array_len = -1}, 
  a_name = 0xb7a12db0, array_len = 0, initializer = 0x0, size = 0, is_global = 0 '\000', isTemp = 0 '\000', declared = 0 '\000', store = 0x0}


src/mesa/shader/slang/slang_codegen.c
  4177  /**
  4178   * Generate IR tree for a reference to a variable (such as in an expression).
  4179   * This is different from a variable declaration.
  4180   */
  4181  static slang_ir_node *
  4182  _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper)
  4183  {
  4184     /* If there's a variable associated with this oper (from inlining)
  4185      * use it.  Otherwise, use the oper's var id.
  4186      */
  4187     slang_atom name = oper->var ? oper->var->a_name : oper->a_id;
  4188     slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE);
  4189     slang_ir_node *n;
  4190     if (!var) {
  4191        slang_info_log_error(A->log, "undefined variable '%s'", (char *) name);
  4192        return NULL;
  4193     }
  4194     assert(var->declared);
  4195     n = new_var(A, var);
  4196     return n;
  4197  }
Comment 1 Brian Paul 2010-05-03 13:02:45 UTC
Fixed in Mesa/master with commit a12614362a79d676eeb1c3030ed52057bcb8f4f8
Comment 2 Vinson Lee 2010-05-03 16:52:34 UTC
mesa: e2ea69afef2eeeb31b73772c3bf8ef696dadbc17 (master)

$ ./bin/glslparsertest tests/glslparsertest/glsl2/function-08.frag fail

The above command no longer crashes.


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.