Bug 98774

Summary: glsl/tests/warnings-test regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: emil.l.velikov, t_arceri
Version: gitKeywords: bisected, have-backtrace, regression
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-11-18 22:13:53 UTC
$ make check
[...]
PASS: glsl/glcpp/tests/glcpp-test
PASS: glsl/glcpp/tests/glcpp-test-cr-lf
PASS: glsl/tests/blob-test
PASS: glsl/tests/cache-test
PASS: glsl/tests/general-ir-test
PASS: glsl/tests/optimization-test
PASS: glsl/tests/sampler-types-test
PASS: glsl/tests/uniform-initializer-test
FAIL: glsl/tests/warnings-test
PASS: nir/tests/control_flow_tests
============================================================================
Testsuite summary for Mesa 13.1.0-devel
============================================================================
# TOTAL: 10
# PASS:  9
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

$ ./glsl_compiler --just-log --version 150 ./glsl/tests/warnings/000-basic-test.vert
0:8(8): warning: `undefined' used uninitialized
Segmentation fault (core dumped)

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000000044a11e in link_intrastage_shaders (mem_ctx=mem_ctx@entry=0x1391320, ctx=ctx@entry=0x717a40 <standalone_compile_shader::local_ctx>, prog=prog@entry=0x1391320, shader_list=0x1391920, 
    num_shaders=num_shaders@entry=1, allow_missing_main=allow_missing_main@entry=true) at glsl/linker.cpp:2196
#2  0x0000000000406c02 in standalone_compile_shader (_options=_options@entry=0x717a10 <options>, num_files=num_files@entry=1, files=<optimized out>) at glsl/standalone.cpp:494
#3  0x000000000040346b in main (argc=<optimized out>, argv=0x7ffe4b919888) at glsl/main.cpp:92
(gdb) frame 1
#1  0x000000000044a11e in link_intrastage_shaders (mem_ctx=mem_ctx@entry=0x1391320, ctx=ctx@entry=0x717a40 <standalone_compile_shader::local_ctx>, prog=prog@entry=0x1391320, shader_list=0x1391920, 
    num_shaders=num_shaders@entry=1, allow_missing_main=allow_missing_main@entry=true) at glsl/linker.cpp:2196
2196	                             prog->Name);
(gdb) print prog->Name
$1 = 0


9d96d3803ab5dc896d4844ac785db57bb1717f91 is the first bad commit
commit 9d96d3803ab5dc896d4844ac785db57bb1717f91
Author: Timothy Arceri <timothy.arceri@collabora.com>
Date:   Mon Oct 31 23:54:03 2016 +1100

    glsl: create gl_program at the start of linking rather than the end
    
    This will allow us to directly store metadata we want to retain in
    gl_program this metadata is currently stored in gl_linked_shader and
    will be lost if relinking fails even though the program will remain
    in use and is still valid according to the spec.
    
    "If a program object that is active for any shader stage is re-linked
    unsuccessfully, the link status will be set to FALSE, but any existing
    executables and associated state will remain part of the current
    rendering state until a subsequent call to UseProgram,
    UseProgramStages, or BindProgramPipeline removes them from use."
    
    This change will also help avoid the double handing that happens in
    _mesa_copy_linked_program_data().
    
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

:040000 040000 97d2bb36e78083ac49ae2858d9d710b755d02941 2aa728acfaf8bc58a74f6ea379023f95c42139bf M	src
bisect run success
Comment 1 Timothy Arceri 2016-11-19 00:16:58 UTC
Thanks, fix sent for review:

https://lists.freedesktop.org/archives/mesa-dev/2016-November/135829.html
Comment 2 Timothy Arceri 2016-11-19 04:01:15 UTC
Pushed fix:

commit 0c85d2fea406df033c27201ba5e7257874a67a9a
Author: Timothy Arceri <timothy.arceri@collabora.com>
Date:   Sat Nov 19 11:11:04 2016 +1100

    glsl: add new program driver function to standalone compiler
    
    This fixes a regression with the standalone compiler caused by
    9d96d3803ab5dc
    
    Note that we change standalone_compiler_cleanup() to no longer
    explicitly free the linked shaders as the will be freed when
    we free the parent ctx whole_program.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98774

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.