[llvm-bugs] [Bug 26522] New: clang crashes on valid code at -O0 on x86_64-linux-gnu running pass 'Fast Register Allocator'

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 7 21:14:54 PST 2016


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

            Bug ID: 26522
           Summary: clang crashes on valid code at -O0 on x86_64-linux-gnu
                    running pass 'Fast Register Allocator'
           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 test case at only
-O0 on x86_64-linux-gnu in 64-bit mode. The 32-bit mode works fine.

It is a regression of 3.7.

$ clang-trunk -v
clang version 3.9.0 (trunk 260025)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.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.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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64



$ clang-trunk -m32 abc.c -c
$ clang-trunk -m64 -O3 abc.c -c
$ clang-3.6 -m64 abc.c -c
abc.c:1:16: warning: unknown attribute 'target' ignored [-Wunknown-attributes]
__attribute__((target("soft-float"))) float fn1(float p1) { return p1; }
               ^
1 warning generated.
$ clang-trunk -m64 abc.c -c
#0 0x0000000001516e18 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1516e18)
#1 0x0000000001515846 llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1515846)
#2 0x0000000001517459 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1517459)
#3 0x00007f0364c3b340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00000000010c5193 (anonymous
namespace)::RAFast::allocVirtReg(llvm::MachineInstr*, (anonymous
namespace)::RAFast::LiveReg*, unsigned int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x10c5193)
#5 0x00000000010c4c19 (anonymous
namespace)::RAFast::defineVirtReg(llvm::MachineInstr*, unsigned int, unsigned
int, unsigned int) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x10c4c19)
#6 0x00000000010c3b95 (anonymous
namespace)::RAFast::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x10c3b95)
#7 0x000000000106ef43 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x106ef43)
#8 0x0000000001224363 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1224363)
#9 0x000000000122454b llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x122454b)
#10 0x0000000001224949 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1224949)
#11 0x0000000001619042 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1619042)
#12 0x0000000001b47aaf
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1b47aaf)
#13 0x0000000001e5f426 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1e5f426)
#14 0x00000000018ec44c clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18ec44c)
#15 0x00000000018b9898
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18b9898)
#16 0x0000000001961bc4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1961bc4)
#17 0x000000000073c676 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x73c676)
#18 0x000000000073b836 main
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x73b836)
#19 0x00007f0363dd8ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#20 0x0000000000738652 _start
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x738652)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name abc.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
-dwarf-column-info -debugger-tuning=gdb -coverage-file
/home/absozero/projects/reduction/crash/abc.c -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o abc.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 'Fast Register Allocator' on function '@fn1'
clang-3.9: error: unable to execute command: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 260025)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

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

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



——
$ cat abc.c
__attribute__((target("soft-float"))) float fn1(float p1) { return p1; }

-- 
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/20160208/80f39f02/attachment-0001.html>


More information about the llvm-bugs mailing list