[llvm-bugs] [Bug 26070] New: clang crashes on code with "__builtin_copysignf" and "__builtin_abort" at -O1 and above on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 7 18:00:19 PST 2016


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

            Bug ID: 26070
           Summary: clang crashes on code with "__builtin_copysignf" and
                    "__builtin_abort" at -O1 and above on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                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. 


$ clang-trunk -O3 abc.c
clang: /home/absozero/trunk/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:632:
const llvm::SDValue &llvm::SDNode::getOperand(unsigned int) const: Assertion
`Num < NumOperands && "Invalid child # of SDNode!"' failed.
#0 0x000000000304dca8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang+0x304dca8)
#1 0x000000000304e417 (/home/absozero/trunk/root-clang/bin/clang+0x304e417)
#2 0x00007ff41d8d7340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007ff41c6bbcc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007ff41c6bf0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007ff41c6b4b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#6 0x00007ff41c6b4c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#7 0x000000000243a2cf (/home/absozero/trunk/root-clang/bin/clang+0x243a2cf)
#8 0x000000000240c5bc (/home/absozero/trunk/root-clang/bin/clang+0x240c5bc)
#9 0x000000000240b42d llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
(/home/absozero/trunk/root-clang/bin/clang+0x240b42d)
#10 0x0000000002537592 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/absozero/trunk/root-clang/bin/clang+0x2537592)
#11 0x00000000025367a7
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/absozero/trunk/root-clang/bin/clang+0x25367a7)
#12 0x00000000025337b6
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang+0x25337b6)
#13 0x0000000002305f21 (/home/absozero/trunk/root-clang/bin/clang+0x2305f21)
#14 0x00000000026f7b89
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang+0x26f7b89)
#15 0x0000000002f93a44 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang+0x2f93a44)
#16 0x0000000002f93c8b llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang+0x2f93c8b)
#17 0x0000000002f94155 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang+0x2f94155)
#18 0x0000000000a0bc8d clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*, std::unique_ptr<llvm::FunctionInfoIndex,
std::default_delete<llvm::FunctionInfoIndex> >)
(/home/absozero/trunk/root-clang/bin/clang+0xa0bc8d)
#19 0x00000000009ec5db (/home/absozero/trunk/root-clang/bin/clang+0x9ec5db)
#20 0x0000000000ca0926 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xca0926)
#21 0x000000000077f3f5 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang+0x77f3f5)
#22 0x00000000007472e1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang+0x7472e1)
#23 0x0000000000725dfc
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang+0x725dfc)
#24 0x000000000071bcb8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang+0x71bcb8)
#25 0x00000000007244a3 main
(/home/absozero/trunk/root-clang/bin/clang+0x7244a3)
#26 0x00007ff41c6a6ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#27 0x000000000071b754 _start
(/home/absozero/trunk/root-clang/bin/clang+0x71b754)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/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 -O3
-fdebug-compilation-dir /home/absozero/compiler/reduction -ferror-limit 19
-fmessage-length 142 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-a1051b.o -x c
abc.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'abc.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 257047) (llvm/trunk 257044)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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/abc-eb0adb.c
clang: note: diagnostic msg: /tmp/abc-eb0adb.sh
clang: note: diagnostic msg: 

********************

$ clang-trunk -v
clang version 3.8.0 (trunk 257047) (llvm/trunk 257044)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.1
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.4
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.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64


------------------------------------------
$ cat abc.c
float __attribute__((noinline))
foo ()
{
  float a;
  return a;
}

int main ()
{
  if (__builtin_copysignf (1.0, foo ()) != 1.0)
    __builtin_abort();
  return 0;
}

-- 
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/20160108/db5a4355/attachment.html>


More information about the llvm-bugs mailing list