<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Non-determinism causes assertion failure in llvm::DwarfCompileUnit::constructImportedEntityDie"
   href="http://llvm.org/bugs/show_bug.cgi?id=22750">22750</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Non-determinism causes assertion failure in llvm::DwarfCompileUnit::constructImportedEntityDie
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

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

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dario.domizioli@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13973" name="attach_13973" title="Imported namespaces stress test">attachment 13973</a> <a href="attachment.cgi?id=13973&action=edit" title="Imported namespaces stress test">[details]</a></span>
Imported namespaces stress test

The attached file is a stress test for imported namespaces. It contains a lot
of statements of the type:
  // ...
  {
    namespace A = base;
    namespace B = A;
    namespace C = B;
    // ...
  }

When generating debug information, the function
llvm::DwarfCompileUnit::constructImportedEntityDie has to construct the DIEs
for each imported namespace in order, because each one depends on the previous
one. For imported entities, the function assumes it can call getDie() and
receive a valid pointer.

However, there is a non-determinism in the order in which these imported
namespaces are processed. This leads to them possibly being processed
out-of-order and this causes the assertion in DwarfCompileUnit:661 to fail.

To reproduce, just compile with -g:
    clang -g ns_stress.cpp

I'm using Clang/LLVM trunk r230945 with triple x86_64-unknown-linux.
It also reproduces with the released Clang 3.6.

I spotted it's a non-determinism issue because:
(a) with smaller tests it seemed to happen randomly, and
(b) when I did some "printf debugging" on the asserting function I verified
that the processing order is actually non-deterministic.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>