<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression: GLB 2.7 segfaults due to bogus linker precision error (259fc505) on dead variable"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=97532">97532</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: GLB 2.7 segfaults due to bogus linker precision error (259fc505) on dead variable
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eero.t.tamminen@intel.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Following commit breaks all GLBenchmark 2.7 tests:
--------------------------------------------------
commit 259fc505454ea6a67aeacf6cdebf1398d9947759
Author:     Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>
AuthorDate: Tue May 24 12:04:53 2016 -0700
Commit:     Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>
CommitDate: Fri Aug 26 15:03:15 2016 -0700

    glsl/linker: Fail linking on ES if uniform precision qualifiers don't match

    When GL_OES_geometry_shader is enabled, this fixes
   
dEQP-GLES31.functional.shaders.linkage.geometry.uniform.rules.type_mismatch_1.

    Signed-off-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>>
    Reviewed-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>>
    Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>>
--------------------------------------------------

Wit that commit in, GLBenchmark 2.7 segfaults to:
--------------------------------------------------
...
Log: glDiscardFramebufferEXT = 0x7ff44873b0a0
Log: error: declarations for uniform `fragmentColorVP` have mismatching
precision qualifiers

Program received signal SIGSEGV, Segmentation fault.
0x0000000000482cf0 in cFont::Draw(float, float) ()
(gdb) bt
#0  0x0000000000482cf0 in cFont::Draw(float, float) ()
#1  0x000000000043233a in GLB::Application::DrawFont(char const*) ()
#2  0x00000000004336ad in GLB::Application::RenderLoadingScreen() ()
#3  0x000000000042e1ec in main ()
(gdb) disassemble
...
   0x0000000000482cd0 <+240>:   callq  0x42d940 <glUniform3fv@plt>
   0x0000000000482cd5 <+245>:   mov    0xa0(%rbx),%eax
   0x0000000000482cdb <+251>:   mov    0x2ae45e(%rip),%rbp        # 0x731140
   0x0000000000482ce2 <+258>:   mov    0x2ae15f(%rip),%r14        # 0x730e48
   0x0000000000482ce9 <+265>:   mov    0x2ae2a8(%rip),%r13        # 0x730f98
=> 0x0000000000482cf0 <+272>:   movb   $0x1,0x0(%rbp,%rax,2)
   0x0000000000482cf5 <+277>:   mov    0xa4(%rbx),%eax
...
(gdb) info registers 
rax            0xffffffff       4294967295
rbx            0x748188 7635336
rcx            0xb      11
rdx            0x7c5280 8147584
rsi            0x502    1282
rdi            0x7a1268 8000104
rbp            0x734d80 0x734d80
<GLB::OpenGLStateManager::m_desired_enabled_vertex_attrib_arrays>
--------------------------------------------------

With the patch reverted, GLB works fine.

Problem is a vertex/fragment shader pair compiled at GLB startup, which
declares the same (above mentioned) uniform in both shaders.  Vertex shader
uses high precision and fragment shader medium precision with GLES (typical
case).

Vertex shader doesn't use the given uniform, so the error is bogus.  Errors
like this should be handled only after optimizations, not before.

Erroring on dead code is nasty, warning on dead code would be OK in this case,
but in general warnings on dead code are nasty too (e.g. bogus warnings about
array accesses that are guarded by correct array size checks, like in some of
the 4.x GCC versions).

Most of the GLB tests don't use that shader, and T-Rex test uses it only at
startup.  T-Rex in GfxBench 3.1 GLES version doesn't have that shader, so
GfxBench works fine.

Question: Is this linker error relevant/appropriate for GLES v2.x, or should it
be generated only for v3.x?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>