https://llvm.org/bugs/show_bug.cgi?id=27744
Bug ID: 27744 Summary: clang crashes on valid code at -Os and above in 32-bit mode on x86_64-linux-gnu: Assertion `VRM->hasPhys(Reg) && "We have unallocated variable!!"' failed Product: clang Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: s...@cs.ucdavis.edu CC: llvm-bugs@lists.llvm.org Classification: Unclassified The current clang trunk crashes when compiling the following code on x86_64-linux-gnu at -Os and above in the 32-bit mode (but not in the 64-bit mode). This is a regression from 3.8.x. $ clang-trunk -v clang version 3.9.0 (trunk 269398) 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.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.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.5 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 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 -m32 -O1 -c small.c $ clang-3.8 -m32 -Os -c small.c $ $ clang-trunk -m32 -Os -c small.c clang-3.9: /tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/RegAllocGreedy.cpp:2382: void {anonymous}::RAGreedy::tryHintRecoloring(llvm::LiveInterval&): Assertion `VRM->hasPhys(Reg) && "We have unallocated variable!!"' failed. #0 0x0000000001dd5245 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-3.9+0x1dd5245) #1 0x0000000001dd31d6 llvm::sys::RunSignalHandlers() (/usr/local/clang-trunk/bin/clang-3.9+0x1dd31d6) #2 0x0000000001dd33f4 SignalHandler(int) (/usr/local/clang-trunk/bin/clang-3.9+0x1dd33f4) #3 0x00007fa50a776340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340) #4 0x00007fa509994cc9 gsignal /build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #5 0x00007fa5099980d8 abort /build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0 #6 0x00007fa50998db86 __assert_fail_base /build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0 #7 0x00007fa50998dc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32) #8 0x0000000001964d5c (anonymous namespace)::RAGreedy::tryHintRecoloring(llvm::LiveInterval&) [clone .isra.490] (/usr/local/clang-trunk/bin/clang-3.9+0x1964d5c) #9 0x00000000019681b2 (anonymous namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) (/usr/local/clang-trunk/bin/clang-3.9+0x19681b2) #10 0x00000000017c5565 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/local/clang-trunk/bin/clang-3.9+0x17c5565) #11 0x0000000001a4a713 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/clang-trunk/bin/clang-3.9+0x1a4a713) #12 0x0000000001a4ad5b llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/clang-trunk/bin/clang-3.9+0x1a4ad5b) #13 0x0000000001f21bca clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1f21bca) #14 0x0000000002552b5d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/clang-trunk/bin/clang-3.9+0x2552b5d) #15 0x00000000028a2acd clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x28a2acd) #16 0x0000000002552ebe clang::CodeGenAction::ExecuteAction() (/usr/local/clang-trunk/bin/clang-3.9+0x2552ebe) #17 0x0000000002236d7e clang::FrontendAction::Execute() (/usr/local/clang-trunk/bin/clang-3.9+0x2236d7e) #18 0x000000000220dad6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/clang-trunk/bin/clang-3.9+0x220dad6) #19 0x00000000022c17c2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/clang-trunk/bin/clang-3.9+0x22c17c2) #20 0x0000000000adc198 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/clang-trunk/bin/clang-3.9+0xadc198) #21 0x0000000000a962ae main (/usr/local/clang-trunk/bin/clang-3.9+0xa962ae) #22 0x00007fa50997fec5 __libc_start_main /build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0 #23 0x0000000000ad8204 _start (/usr/local/clang-trunk/bin/clang-3.9+0xad8204) Stack dump: 0. Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-file /data2/small.c -resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Os -fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 163 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -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 'Greedy Register Allocator' on function '@fn1' clang-3.9: error: unable to execute command: Aborted (core dumped) clang-3.9: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.9.0 (trunk 269398) Target: i386-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/tools/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/small-48b868.c clang-3.9: note: diagnostic msg: /tmp/small-48b868.sh clang-3.9: note: diagnostic msg: ******************** $ ------------------------------------------ int printf (const char *, ...); int a, b, d; char f; struct S0 { int f0:1; int f1; unsigned f2:6; int:26; int:1; int f5:20; int f6; } h; void fn1 () { struct S0 k = { 0, 0, 1, 1, 0 }; if (!d) { h = k; d = (a ^ b) & -b ? a : a - b; } char l = f; while (1) { a = -k.f2; k.f2 = a; if (h.f5) f = k.f6 || l; if (d) { struct S0 m = k = h; a = m.f0; } printf ("0"); } } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs