<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 --- - recursive types with typedefs do not resolve properly when printing type"
   href="http://llvm.org/bugs/show_bug.cgi?id=20486">20486</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>recursive types with typedefs do not resolve properly when printing type
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>compnerd@compnerd.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When attempting to print a recursive structure type in lldb built with
assertions, the following assertion is triggered in clang:

Assertion `ExternalFieldOffsets.find(Field) != ExternalFieldOffsets.end() &&
"Field does not have an external offset"' failed

Its unclear whether the assertion in clang is overly aggressive or if the lldb
construction of the type is at fault.

A reproduction for this issue is inlined below.  Note that the separation of
the TUs is required for the reproduction:


#if defined(TU_ONE)
typedef struct t *tp;
typedef tp (*get_tp)();

struct s {
  get_tp_p get_tp;
};

struct t {
  struct s *s;
};

struct t t;
#elif defined(TU_TWO)
typedef struct t *tp;
extern struct t t;
int main() {
  tp tpi = &t;
  return 0;
}
#else
#error there are 2 tus
#endif

To reproduce, set a temporary breakpoint on main; run; next; p tpi; p *tpi

Immediately printing the structure recursively (p *tpi) will actually resolve
the structure layout and cache it, preventing the issue.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>