<html>
    <head>
      <base href="https://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 --- - X86: MachineBasicBlock::getFirstTerminator returns end() in llvm::getFuncletMembership"
   href="https://llvm.org/bugs/show_bug.cgi?id=28938">28938</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86: MachineBasicBlock::getFirstTerminator returns end() in llvm::getFuncletMembership
          </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>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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If you add an assertion after the call to MachineBasicBlock::getFirstTerminator
in llvm::getFuncletMembership that it's not the end() iterator, 48 X86
testcases fail.  IIUC, every MachineBasicBlock should end with a terminator, so
this seems like a bug in X86.

I'm about to commit a patch that papers over this by checking for end() (to
avoid dereferencing it) to unblock my work on <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED --- - static_cast() of sentinel value in LLVM intrusive lists is Undefined Behavior"
   href="show_bug.cgi?id=26753">bug 26753</a>.

Here are the tests that fail locally for me if you use an assertion instead:
--
Failing Tests (48):
    LLVM :: CodeGen/WinEH/wineh-nested-unwind.ll
    LLVM :: CodeGen/WinEH/wineh-noret-cleanup.ll
    LLVM :: CodeGen/X86/branchfolding-catchpads.ll
    LLVM :: CodeGen/X86/catchpad-dynamic-alloca.ll
    LLVM :: CodeGen/X86/catchpad-lifetime.ll
    LLVM :: CodeGen/X86/catchpad-realign-savexmm.ll
    LLVM :: CodeGen/X86/catchpad-regmask.ll
    LLVM :: CodeGen/X86/catchpad-weight.ll
    LLVM :: CodeGen/X86/catchret-empty-fallthrough.ll
    LLVM :: CodeGen/X86/catchret-fallthrough.ll
    LLVM :: CodeGen/X86/catchret-regmask.ll
    LLVM :: CodeGen/X86/cleanuppad-inalloca.ll
    LLVM :: CodeGen/X86/cleanuppad-large-codemodel.ll
    LLVM :: CodeGen/X86/cleanuppad-realign.ll
    LLVM :: CodeGen/X86/deopt-bundles.ll
    LLVM :: CodeGen/X86/funclet-layout.ll
    LLVM :: CodeGen/X86/late-address-taken.ll
    LLVM :: CodeGen/X86/pr26757.ll
    LLVM :: CodeGen/X86/pr27501.ll
    LLVM :: CodeGen/X86/regalloc-spill-at-ehpad.ll
    LLVM :: CodeGen/X86/seh-catch-all-win32.ll
    LLVM :: CodeGen/X86/seh-catch-all.ll
    LLVM :: CodeGen/X86/seh-catchpad.ll
    LLVM :: CodeGen/X86/seh-except-finally.ll
    LLVM :: CodeGen/X86/seh-exception-code.ll
    LLVM :: CodeGen/X86/seh-finally.ll
    LLVM :: CodeGen/X86/seh-safe-div-win32.ll
    LLVM :: CodeGen/X86/seh-safe-div.ll
    LLVM :: CodeGen/X86/seh-stack-realign.ll
    LLVM :: CodeGen/X86/tail-dup-catchret.ll
    LLVM :: CodeGen/X86/tail-merge-wineh.ll
    LLVM :: CodeGen/X86/win-catchpad-csrs.ll
    LLVM :: CodeGen/X86/win-catchpad-nested-cxx.ll
    LLVM :: CodeGen/X86/win-catchpad-nested.ll
    LLVM :: CodeGen/X86/win-catchpad-varargs.ll
    LLVM :: CodeGen/X86/win-catchpad.ll
    LLVM :: CodeGen/X86/win-cleanuppad.ll
    LLVM :: CodeGen/X86/win-funclet-cfi.ll
    LLVM :: CodeGen/X86/win-mixed-ehpersonality.ll
    LLVM :: CodeGen/X86/win32-eh-states.ll
    LLVM :: CodeGen/X86/win32-eh.ll
    LLVM :: CodeGen/X86/win32-seh-catchpad-realign.ll
    LLVM :: CodeGen/X86/win32-seh-catchpad.ll
    LLVM :: CodeGen/X86/win32-seh-nested-finally.ll
    LLVM :: CodeGen/X86/wineh-coreclr.ll
    LLVM :: CodeGen/X86/wineh-exceptionpointer.ll
    LLVM :: DebugInfo/COFF/comdat.ll
    LLVM :: Transforms/IndVarSimplify/iv-widen-elim-ext.ll
--</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>