<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 - [GLSL] Unused arrays declared without a size should be handled like arrays of size 1."
   href="https://bugs.freedesktop.org/show_bug.cgi?id=106915">106915</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GLSL] Unused arrays declared without a size should be handled like arrays of size 1.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Mesa core
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>estea@igalia.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From GLSLang Spec 4.60 Section 4.2 Scoping:

"An array implicitly sized in one shader can be explicitly sized by another
shader in the same stage. If no shader in a stage has an explicit size for the
array, the largest implicit size (one more than the largest index used) in that
stage is used. There is no cross-stage array sizing. If there is no static
access to an implicitly sized array within the stage declaring it, then the
array is given a size of 1, which is relevant when the array is declared within
an interface block that is shared with other stages or the application (other
unused arrays might be eliminated by the optimizer)."

According to the paragraph above, the following piglit test should not generate
any errors as s[] would be treated as an array of size 1:

[vertex shader]
#version 150
#extension GL_ARB_shader_storage_buffer_object: require
buffer a {
        vec4 s[];
        vec4 a[];
} b;

in vec4 piglit_vertex;
out vec4 c;

void main(void) {
        c = b.a[0];

        gl_Position = piglit_vertex;
}

[test]
link error

Test:
spec/arb_shader_storage_buffer_object/linker/unsized_array_member.shader_test

but it does.

If we convert the GLSL code to SPIR-V there are no linker errors anymore since
s[] seems to have type: OpTypeArray with size 1 and the linker accepts it.</pre>
        </div>
      </p>


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

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