<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 --- - Assertion failed: (isImm() && "Wrong MachineOperand accessor"), function getImm, file include/llvm/CodeGen/MachineOperand.h, line 411."
   href="https://llvm.org/bugs/show_bug.cgi?id=27071">27071</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (isImm() && "Wrong MachineOperand accessor"), function getImm, file include/llvm/CodeGen/MachineOperand.h, line 411.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.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>This assertion was reported on the freebsd-current mailing list. [1]  It occurs
when compiling with -Os -fpic for the i386 target.  FreeBSD 11 has clang 3.8.0
release, but it still reproduces with trunk r264394.

Reduced test case:

typedef struct {
} x0;
_Thread_local int x1;
void x2(x0*);
void x3(void) {
  x0 x4;
  switch (x1) {
  case '\\':
    x2(&x4);
  }
}

Compilation flags:

clang -cc1 -triple i386 -emit-obj -mrelocation-model pic -pic-level 1 -Os
testcase.c

Stack trace:

#0  0x2b7eba43 in thr_kill () from /lib/libc.so.7
#1  0x2b7eba28 in __raise (s=0) at
/share/dim/src/freebsd/base/head/lib/libc/gen/raise.c:52
#2  0x2b7eb963 in abort () at
/share/dim/src/freebsd/base/head/lib/libc/stdlib/abort.c:65
#3  0x2b867708 in __assert (func=0xaf301dc "getImm", file=0xbfbfcaa8
"\250\312\277\277\006", line=411, failedexpr=<optimized out>) at
/share/dim/src/freebsd/base/head/lib/libc/gen/assert.c:51
#4  0x089fe334 in llvm::X86InstrInfo::getSPAdjust(llvm::MachineInstr const*)
const ()
#5  0x08d2ffbd in (anonymous
namespace)::PEI::replaceFrameIndices(llvm::MachineBasicBlock*,
llvm::MachineFunction&, int&) ()
#6  0x08d2de0c in (anonymous
namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) ()
#7  0x08cc0e17 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) ()
#8  0x08f5e41b in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
#9  0x08f5e6c2 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
#10 0x08f5ec47 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
#11 0x08f5f2e8 in llvm::legacy::PassManager::run(llvm::Module&) ()
#12 0x09502d24 in clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) ()
#13 0x09ce258c in
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#14 0x0a0e5c15 in clang::ParseAST(clang::Sema&, bool, bool) ()
#15 0x09942226 in clang::ASTFrontendAction::ExecuteAction() ()
#16 0x09ce10ce in clang::CodeGenAction::ExecuteAction() ()
#17 0x09941b03 in clang::FrontendAction::Execute() ()
#18 0x0990698a in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#19 0x099dcddb in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#20 0x0830b327 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) ()
#21 0x08309c46 in main ()

[1] <a href="https://lists.freebsd.org/pipermail/freebsd-current/2016-March/060290.html">https://lists.freebsd.org/pipermail/freebsd-current/2016-March/060290.html</a></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>