<html>
    <head>
      <base href="https://bugs.llvm.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 - [ThinLTO] Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) && "invalid type for global variable"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=35247">35247</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ThinLTO] Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) && "invalid type for global variable"' failed.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </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>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Tested at r316607 on release_50.

==> a.cpp <==
int* A();

int main() {
  int* s(A());
}

==> b.cpp <==
struct SF {
  SF();
};

SF::SF() {}

SF* A() {
  new SF();
}
$ clang -o a.o -flto=thin -c a.cpp
$ clang -o b.o -flto=thin -c b.cpp
$ llvm-lto a.o b.o --thinlto-action=run
llvm-lto: .../llvm/lib/IR/Globals.cpp:317:
llvm::GlobalVariable::GlobalVariable(llvm::Module&, llvm::Type*, bool,
llvm::GlobalValue::LinkageTypes, llvm::Constant*, const llvm::Twine&,
llvm::GlobalVariable*, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool):
Assertion `!Ty->isFunctionTy() && PointerType::isValidElementType(Ty) &&
"invalid type for global variable"' failed.

Not seen on master (r317500).

Note that there are multiple versions of A() in this example. With this fixed,
there is no assertion failure.</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>