<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 - dEQP-GLES3: dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex fails because of wrong __LINE__ values"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89642">89642</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>dEQP-GLES3: dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex fails because of wrong __LINE__ values
          </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>Mesa core
          </td>
        </tr>

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

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

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>DEQP failed test:

dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex

-------

The test does a complex __LINE__ macro replacement. The shaders are created
from the following template in modules/gles3/gles3/shader/preprocessor.test
file:
         #version 300 es
         precision mediump float;
         ${DECLARATIONS:single-line}
         #define BBB      __LINE__, /*
            */ __LINE__
         #define AAA(a,b) BBB, a, b

         void main()
         {
            out0 = vec4(AAA(__LINE__,
                  __LINE__
                  ));
            ${OUTPUT}
         }

It expects to have out0 filled with (12, 12, 10, 11) values. Mesa gives (4, 5,
10, 11). I created a C program that mimics the shader (because Mesa follows a
draft of C99 standard, see src/glsl/glcpp/README) but I got different results
depending of which C compiler was used:

* gcc --std=c99 (or without c99, it doesn't matter) prints: 12, 12, 12, 12
* clang prints: 12, 12, 10, 11.

Mesa calculates the LINE macro values as the line numbers of where the macro is
seen in the code before doing any expansion, as special case in glcpp-parse.y,
function _glcpp_parser_expand_node().

-------

Tested on Haswell with Mesa master: 27bf37ba05b69ebf6f373d1637a26b4839265921</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>