[LLVMbugs] [Bug 13402] New: llvm/lib/Target/X86/X86MCInstLower.cpp:242: void SimplifyShortImmForm(llvm::MCInst &, unsigned int): Assertion [...] && "Unexpected instruction" failed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 19 04:49:48 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13402

             Bug #: 13402
           Summary: llvm/lib/Target/X86/X86MCInstLower.cpp:242: void
                    SimplifyShortImmForm(llvm::MCInst &, unsigned int):
                    Assertion [...] && "Unexpected instruction" failed
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: merkil at savhon.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hello !
LLVM/Clang as of 160454 fails on this testcase on x86 at -O2 and higher.


$ cat file.c
int a, b;
unsigned char c;

void func(void)
{
    int d, e, f;
    char *p1 = 1, *p2 = &f, *p3 = &a;

    for(; c; c++)
    {
        while(*p3)
        {
            a = b ? 0 : (c > f);

            if((e > 0) <= (e = !!(d & c)) > (d = 0))
                *p1 = b || *p1 != (d = 1);
            else
                *p3 /= ((c = 0), (a ? 1 : (a = 0) != (*p1 = (c /= 0) > (++c)) ?
0 : c));
        }

        p1 = p2;
    }
}

(sorry, it's a bit messy)

$ clang -O2 -w file.c
clang: /home/merkil/clang/llvm/lib/Target/X86/X86MCInstLower.cpp:242: 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.
0  clang     0x09d46b48
1  clang     0x09d47094
2            0xb773e400 __kernel_sigreturn + 0
3            0xb773e424 __kernel_vsyscall + 16
4  libc.so.6 0xb74706ef gsignal + 79
5  libc.so.6 0xb7472250 abort + 384
6  libc.so.6 0xb7468856 __assert_fail + 246
7  clang     0x09410a2f
8  clang     0x0941430b
9  clang     0x09414c3b
10 clang     0x09671c50 llvm::AsmPrinter::EmitFunctionBody() + 192
11 clang     0x0940bdd3
12 clang     0x096f839a
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 186
13 clang     0x09cce063 llvm::FPPassManager::runOnFunction(llvm::Function&) +
659
14 clang     0x09cce0ec llvm::FPPassManager::runOnModule(llvm::Module&) + 76
15 clang     0x09ccdd20 llvm::MPPassManager::runOnModule(llvm::Module&) + 592
16 clang     0x09cd1778 llvm::PassManagerImpl::run(llvm::Module&) + 168
17 clang     0x09cd1886 llvm::PassManager::run(llvm::Module&) + 38
18 clang     0x08498d0f clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::Module*, clang::BackendAction, 
llvm::raw_ostream*) + 2079
19 clang     0x08496b89
20 clang     0x0861550a clang::ParseAST(clang::Sema&, bool, bool) + 410
21 clang     0x0834a20f clang::ASTFrontendAction::ExecuteAction() + 111
22 clang     0x08494eab clang::CodeGenAction::ExecuteAction() + 43
23 clang     0x0834ab40 clang::FrontendAction::Execute() + 176
24 clang     0x0832b4e8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 312
25 clang     0x0831149d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1197
26 clang     0x08308b54 cc1_main(char const**, char const**, char const*,
void*) + 948
27 clang     0x082f1a36 main + 758
28 libc.so.6 0xb7459503 __libc_start_main + 243
29 clang     0x0830647d
Stack dump:
0.    Program arguments: /home/merkil/clang/build/Release+Asserts/bin/clang
-cc1 -triple i386-pc-linux-gnu -emit-obj -disable-free -main-file-name file.c
-mrelocation-model static -fmath-errno 
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.21.1 -momit-leaf-frame-pointer -resource-dir
/home/merkil/clang/build/Release+Asserts/bin/../lib/clang/3.2 
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/local/include -internal-isystem
/home/merkil/clang/build/Release+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem 
/include -internal-externc-isystem /usr/include -O2 -w -fdebug-compilation-dir
/home/merkil -ferror-limit 19 -fmessage-length 213 -mstackrealign
-fobjc-runtime=gcc -fdiagnostics-show-option 
-fcolor-diagnostics -o /tmp/file-V6VQm9.o -x c file.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'file.c'.
4.    Running pass 'X86 AT&T-Style Assembly Printer' on function '@func'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 160454)
Target: i386-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.

Don't hesitate to ask me for further details if needed.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list