<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - Clang crashes when compiling invalid LLVM IR file"
   href="https://bugs.llvm.org/show_bug.cgi?id=46436">bug 46436</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WONTFIX
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>aprantl@apple.com, florian_hahn@apple.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Summary</td>
           <td>Internal clang error while compiling llvm code
           </td>
           <td>Clang crashes when compiling invalid LLVM IR file
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - Clang crashes when compiling invalid LLVM IR file"
   href="https://bugs.llvm.org/show_bug.cgi?id=46436#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - Clang crashes when compiling invalid LLVM IR file"
   href="https://bugs.llvm.org/show_bug.cgi?id=46436">bug 46436</a>
              from <span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
        <pre>I think this works as expected. The IR is invalid and most LLVM tools use
report_fatal_error to abort on invalid IR. The relevant abort is here:
<a href="https://github.com/llvm/llvm-project/blob/07f335128410ca2dbb4b78050132ecd070e2e425/llvm/lib/IR/AutoUpgrade.cpp#L3867">https://github.com/llvm/llvm-project/blob/07f335128410ca2dbb4b78050132ecd070e2e425/llvm/lib/IR/AutoUpgrade.cpp#L3867</a>

I'll go ahead and mark as wont fix for now. If I am missing something, please
feel free to re-open.


Note that this should only be an issue with invalid IR files provided by a
user. Frontends, the middle-end and back-ends should should never produce
invalid IR.

Running with opt produces:

opt -verify t.ll
Aliasee should be either GlobalValue or ConstantExpr
i32 ()* @g.0
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0.      Program arguments: bin/opt -verify t.ll
0  opt                      0x000000010764a6b5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  opt                      0x0000000107649458 llvm::sys::RunSignalHandlers() +
248
2  opt                      0x000000010764aca6 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff722cc5fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338600626720
5  libsystem_c.dylib        0x00007fff721a2808 abort + 120
6  opt                      0x00000001075a4efb
llvm::report_fatal_error(llvm::Twine const&, bool) + 427
7  opt                      0x00000001075a4d4b llvm::report_fatal_error(char
const*, bool) + 43
8  opt                      0x0000000106ddb1ff
llvm::UpgradeDebugInfo(llvm::Module&) + 207
9  opt                      0x0000000106947f0b
llvm::LLParser::ValidateEndOfModule(bool) + 2523</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>