<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 --- - DISubprogram treats return type in inconsistent way causing assertion failure in Verify"
   href="http://llvm.org/bugs/show_bug.cgi?id=15529">15529</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DISubprogram treats return type in inconsistent way causing assertion failure in Verify
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kai@redstar.de
          </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>I try to create debug info for a function which returns an int.

The return type is created via DIBuilder->createBasicType() and the returned
object is passed to DIBuilder->createFunction() as the return type.
I get an assertion failure if I call DISubprogram->Verify() on such constructed
object.

According to the DWARF 3/4 spec my approach is legal. The right value is
returned by DISubprogram->getReturnTypeName() because it is implemented as the
comment specifies:

    /// getReturnTypeName - Subprogram return types are encoded either as
    /// DIType or as DICompositeType.

But:
- DISubprogram->Verify() fails because it always expects a DICompositeType
- You can't retrieve the return type if it is different from DICompositeType
because DISubprogram->getType() always returns a DICompositeType.

Resolution would be:
(a) always require a DICompositeType for the return type OR
(b) implement getType() and Verify() analog to getReturnTypeName()</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>