[llvm-bugs] [Bug 24803] New: clang crashes on code with inlined assembly on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 12 22:47:38 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24803

            Bug ID: 24803
           Summary: clang crashes on code with inlined assembly on
                    x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following code in both
32-bit and 64-bit modes on x86_64-linux-gnu.  

It seems to crash every release of clang from as early as 2.9. 

The code has an inconsistently typed operand for frndint. 


$ clang-trunk -v
clang version 3.8.0 (trunk 247514)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -c small.c
clang: /tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:388: void
getCopyToParts(llvm::SelectionDAG &, llvm::SDLoc, llvm::SDValue, llvm::SDValue
*, unsigned int, llvm::MVT, const llvm::Value *, ISD::NodeType): Assertion
`(PartVT.isInteger() || PartVT == MVT::x86mmx) && ValueVT.isInteger() &&
"Unknown mismatch!"' failed.
#0 0x2dcb8ed llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x2dcb8ed)
#1 0x2dcaf76 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x2dcaf76)
#2 0x2dcd0ee (/usr/local/clang-trunk/bin/clang+0x2dcd0ee)
#3 0x7fca4964c340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7fca485e7cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7fca485eb0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7fca485e0b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x7fca485e0c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x233da81 (/usr/local/clang-trunk/bin/clang+0x233da81)
#9 0x233b2d5 llvm::RegsForValue::getCopyToRegs(llvm::SDValue,
llvm::SelectionDAG&, llvm::SDLoc, llvm::SDValue&, llvm::SDValue*, llvm::Value
const*, llvm::ISD::NodeType) const (/usr/local/clang-trunk/bin/clang+0x233b2d5)
#10 0x2355c21
llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite)
(/usr/local/clang-trunk/bin/clang+0x2355c21)
#11 0x233e862 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&)
(/usr/local/clang-trunk/bin/clang+0x233e862)
#12 0x2387428
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&)
(/usr/local/clang-trunk/bin/clang+0x2387428)
#13 0x2386cc6 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function
const&) (/usr/local/clang-trunk/bin/clang+0x2386cc6)
#14 0x2383f6f
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang+0x2383f6f)
#15 0x2171001 (/usr/local/clang-trunk/bin/clang+0x2171001)
#16 0x252fa7c llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x252fa7c)
#17 0x2d1b444 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x2d1b444)
#18 0x2d1b68b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2d1b68b)
#19 0x2d1bb65 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2d1bb65)
#20 0x9d05ed clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang+0x9d05ed)
#21 0x9b2d73 (/usr/local/clang-trunk/bin/clang+0x9b2d73)
#22 0xc38f26 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xc38f26)
#23 0x7750f5 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x7750f5)
#24 0x74247c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x74247c)
#25 0x7221d7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x7221d7)
#26 0x718225 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/clang-trunk/bin/clang+0x718225)
#27 0x72086f main (/usr/local/clang-trunk/bin/clang+0x72086f)
#28 0x7fca485d2ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#29 0x717cb9 _start (/usr/local/clang-trunk/bin/clang+0x717cb9)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 103 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'small.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 247514)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
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.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-bcd145.c
clang: note: diagnostic msg: /tmp/small-bcd145.sh
clang: note: diagnostic msg: 

********************
$ 


--------------------------------------


void foo ()
{
  int v;  // should have been "float v;" 
  asm ("frndint":"=t" (v):"0" (v));
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150913/6161e217/attachment.html>


More information about the llvm-bugs mailing list