https://llvm.org/bugs/show_bug.cgi?id=26524
Bug ID: 26524 Summary: clang crashes on valid code at -O2 and -O3 on x86_64-linux-gnu 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 test case on x86_64-linux-gnu at -O2 and -O3 in both 32-bit and 64-bit modes. This is a regression from 3.7.x. $ clang-trunk -v clang version 3.9.0 (trunk 260022) 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.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 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 -Os -c small.c $ clang-3.7 -O2 -c small.c $ $ clang-trunk -O2 -c small.c clang-3.9: /tmp/llvm/lib/Transforms/Utils/LoopUnroll.cpp:604: bool llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned int, bool, bool, unsigned int, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*, llvm::AssumptionCache*, bool): Assertion `OuterL->isLCSSAForm(*DT) && "Loops should be in LCSSA form after loop-unroll."' failed. #0 0x0000000002c9accd llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-3.9+0x2c9accd) #1 0x0000000002c9afe2 PrintStackTraceSignalHandler(void*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c9afe2) #2 0x0000000002c9962f llvm::sys::RunSignalHandlers() (/usr/local/clang-trunk/bin/clang-3.9+0x2c9962f) #3 0x0000000002c9a743 SignalHandler(int) (/usr/local/clang-trunk/bin/clang-3.9+0x2c9a743) #4 0x00007f0ac43a9340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340) #5 0x00007f0ac35c7cc9 gsignal /build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #6 0x00007f0ac35cb0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0 #7 0x00007f0ac35c0b86 __assert_fail_base /build/buildd/eglibc-2.19/assert/assert.c:92:0 #8 0x00007f0ac35c0c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32) #9 0x0000000002cf0b97 llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned int, bool, bool, unsigned int, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*, llvm::AssumptionCache*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2cf0b97) #10 0x0000000002b4f92f tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, bool, llvm::Optional<unsigned int>, llvm::Optional<unsigned int>, llvm::Optional<bool>, llvm::Optional<bool>) (/usr/local/clang-trunk/bin/clang-3.9+0x2b4f92f) #11 0x0000000002b4fbf5 (anonymous namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&) (/usr/local/clang-trunk/bin/clang-3.9+0x2b4fbf5) #12 0x000000000382eed1 llvm::LPPassManager::runOnFunction(llvm::Function&) (/usr/local/clang-trunk/bin/clang-3.9+0x382eed1) #13 0x00000000027ebf58 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/clang-trunk/bin/clang-3.9+0x27ebf58) #14 0x000000000380a819 (anonymous namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&, llvm::CallGraph&, bool&, bool&) (/usr/local/clang-trunk/bin/clang-3.9+0x380a819) #15 0x000000000380b915 (anonymous namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&, llvm::CallGraph&, bool&) (/usr/local/clang-trunk/bin/clang-3.9+0x380b915) #16 0x000000000380bc38 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) (/usr/local/clang-trunk/bin/clang-3.9+0x380bc38) #17 0x00000000027ec486 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) (/usr/local/clang-trunk/bin/clang-3.9+0x27ec486) #18 0x00000000027ecbf0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/clang-trunk/bin/clang-3.9+0x27ecbf0) #19 0x00000000027ece31 llvm::legacy::PassManager::run(llvm::Module&) (/usr/local/clang-trunk/bin/clang-3.9+0x27ece31) #20 0x0000000002e89374 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x2e89374) #21 0x0000000002e894bb 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-3.9+0x2e894bb) #22 0x00000000036bfe4f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/clang-trunk/bin/clang-3.9+0x36bfe4f) #23 0x0000000003ef2148 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x3ef2148) #24 0x000000000332976a clang::ASTFrontendAction::ExecuteAction() (/usr/local/clang-trunk/bin/clang-3.9+0x332976a) #25 0x00000000036c2cb8 clang::CodeGenAction::ExecuteAction() (/usr/local/clang-trunk/bin/clang-3.9+0x36c2cb8) #26 0x000000000332922f clang::FrontendAction::Execute() (/usr/local/clang-trunk/bin/clang-3.9+0x332922f) #27 0x00000000032e40f8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/clang-trunk/bin/clang-3.9+0x32e40f8) #28 0x000000000341cca6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/clang-trunk/bin/clang-3.9+0x341cca6) #29 0x000000000157e726 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/clang-trunk/bin/clang-3.9+0x157e726) #30 0x00000000015758c3 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) (/usr/local/clang-trunk/bin/clang-3.9+0x15758c3) #31 0x0000000001576391 main (/usr/local/clang-trunk/bin/clang-3.9+0x1576391) #32 0x00007f0ac35b2ec5 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:321:0 #33 0x0000000001571cf9 _start (/usr/local/clang-trunk/bin/clang-3.9+0x1571cf9) Stack dump: 0. Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -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 /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 144 -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. Per-module optimization passes 3. Running pass 'CallGraph Pass Manager' on module 'small.c'. 4. Running pass 'Loop Pass Manager' on function '@fn1' 5. Running pass 'Unroll loops' on basic block '%while.cond' 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 260022) Target: x86_64-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-63a9dd.c clang-3.9: note: diagnostic msg: /tmp/small-63a9dd.sh clang-3.9: note: diagnostic msg: ******************** $ ------------------------------ short a; int b, *c = &b, d; int fn1 () { int j = 0; for (; d;) for (; j < 1; j++) while (b) { *c = 4; for (; *c;) return a; } return 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