<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 --- - X86MCInstLower.cpp:298: void SimplifyShortImmForm(llvm::MCInst&, unsigned int): Assertion `Inst.getOperand(0).isReg() && (Inst.getOperand(ImmOp).isImm() || Inst.getOperand(ImmOp).isExpr()) && ((Inst.getNumOperands() == 3 && Inst.getOperand(1).isReg() &&"
   href="http://llvm.org/bugs/show_bug.cgi?id=21008">21008</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86MCInstLower.cpp:298: void SimplifyShortImmForm(llvm::MCInst&, unsigned int): Assertion `Inst.getOperand(0).isReg() && (Inst.getOperand(ImmOp).isImm() || Inst.getOperand(ImmOp).isExpr()) && ((Inst.getNumOperands() == 3 && Inst.getOperand(1).isReg() &&
          </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>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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nlewycky@google.com
          </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>Testcase x.ii:

struct A {
  A(int);
};
struct B {
  int : 16;
  bool member : 1;
  int pointer;
};
void fn1(bool, A);
void fn2() {
  B b;
  fn1(b.member, 0);
}

Crash:

nlewycky@ducttape:~$
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -std=gnu++11
-emit-obj -o /dev/null -w -x c++ x.ii
clang: X86MCInstLower.cpp:298: void SimplifyShortImmForm(llvm::MCInst&,
unsigned int): Assertion `Inst.getOperand(0).isReg() &&
(Inst.getOperand(ImmOp).isImm() || Inst.getOperand(ImmOp).isExpr()) &&
((Inst.getNumOperands() == 3 && Inst.getOperand(1).isReg() &&
Inst.getOperand(0).getReg() == Inst.getOperand(1).getReg()) ||
Inst.getNumOperands() == 2) && "Unexpected instruction!"' failed.

#4  0x00000000031cec76 in SimplifyShortImmForm (Inst=..., Opcode=179) at
X86MCInstLower.cpp:294
#5  0x00000000031d0a26 in (anonymous namespace)::X86MCInstLower::Lower
(this=0x7fffffffc000, MI=0x66e5ca8, OutMI=...) at X86MCInstLower.cpp:645

(gdb) call Inst.dump()
<MCInst 183 <MCOperand Reg:23> <MCOperand Reg:19> <MCOperand Imm:1>>

(gdb) call MF.dump()
# Machine code for function _Z3fn2v: Post SSA
Frame Objects:
  fi#0: size=8, align=8, at location [SP-8]
  fi#1: size=1, align=8, at location [SP-16]
  fi#2: size=4, align=4, at location [SP-20]

BB#0: derived from LLVM BB %entry
        %RSP<def,tied1> = SUB64ri8 %RSP<tied0>, 24, %EFLAGS<imp-def,dead>;
flags: FrameSetup
        %RDI<def> = LEA64r %RSP, 1, %noreg, 8, %noreg
        %ESI<def,tied1> = XOR32rr %ESI<undef,tied0>, %ESI<undef>,
%EFLAGS<imp-def>
        %EAX<def> = MOV32rm %RSP, 1, %noreg, 16, %noreg; mem:LD4[%0]
        %EAX<def,tied1> = SHR32ri %EAX<tied0>, 16, %EFLAGS<imp-def>
        %EAX<def,tied1> = AND32ri %EAX<tied0>, 1, %EFLAGS<imp-def>
        MOV32mr %RSP, 1, %noreg, 4, %noreg, %EAX<kill>; mem:ST4[FixedStack2]
        CALL64pcrel32 <ga:@_ZN1AC1Ei>[TF=6], <regmask>, %RSP<imp-use>,
%RDI<imp-use,kill>, %ESI<imp-use,kill>
        %EAX<def> = MOV32rm %RSP, 1, %noreg, 4, %noreg; mem:LD4[FixedStack2]
        %EDI<def,tied1> = AND32ri %EAX<kill,tied0>, 1, %EFLAGS<imp-def>
        MOV32mr %RSP, 1, %noreg, 4, %noreg, %EDI; mem:ST4[FixedStack2]
        CALL64pcrel32 <ga:@_Z3fn1b1A>[TF=6], <regmask>, %RSP<imp-use>,
%EDI<imp-use,kill>
        %RSP<def,tied1> = ADD64ri8 %RSP<tied0>, 24, %EFLAGS<imp-def,dead>
        RETQ

# End machine code for function _Z3fn2v.</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>