<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 - [Gallium] uninitialized once_flag causes unregistered targets"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=95128">95128</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Gallium] uninitialized once_flag causes unregistered targets
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.2
          </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>major
          </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>frederic.devernay@m4x.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From this commit:
<a href="https://cgit.freedesktop.org/mesa/mesa/commit/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp?id=76cfd6f1da3748effb480e4f1151910af59fb88a">https://cgit.freedesktop.org/mesa/mesa/commit/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp?id=76cfd6f1da3748effb480e4f1151910af59fb88a</a>

there is the line
static once_flag init_native_targets_once_flag;

where the once_flag is not initialized. This causes pthread_once() to never
call the function on some OSs (I got the bug with OSX 10.6, but not with OSX
10.11).

once_flags should *always* be initialized, as in:
static once_flag init_native_targets_once_flag = ONCE_FLAG_INIT;


The consequence is that I get errors like
"Unable to find target for this triple (no targets are registered)"
when using llvmpipe

I checked other places in Mesa that use once_flag, they are all initialized
correctly.</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>