[llvm-bugs] [Bug 28637] New: clang crashes on valid code at (only) -O2 on x86_64-linux-gnu (in pass 'Unroll loops')
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 20 23:46:47 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28637
Bug ID: 28637
Summary: clang crashes on valid code at (only) -O2 on
x86_64-linux-gnu (in pass 'Unroll loops')
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 test case on
x86_64-linux-gnu at -O2 in both 32-bit and 64-bit modes.
This is a regression from 3.8.x.
$ clang -v
clang version 4.0.0 (trunk 275948)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-r275948/bin
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
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 -Os -c small.c
$
$ clang-3.8 -O2 -c small.c
$
$ clang -O2 -c small.c
#0 0x0000000001d8b0f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-r275948/bin/clang-4.0+0x1d8b0f5)
#1 0x0000000001d891ae llvm::sys::RunSignalHandlers()
(/usr/local/clang-r275948/bin/clang-4.0+0x1d891ae)
#2 0x0000000001d89310 SignalHandler(int)
(/usr/local/clang-r275948/bin/clang-4.0+0x1d89310)
#3 0x00007fadb1cc4340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00000000015b1da8 llvm::LoopBase<llvm::BasicBlock,
llvm::Loop>::getExitBlocks(llvm::SmallVectorImpl<llvm::BasicBlock*>&) const
(/usr/local/clang-r275948/bin/clang-4.0+0x15b1da8)
#5 0x0000000001dcfea6
llvm::formLCSSAForInstructions(llvm::SmallVectorImpl<llvm::Instruction*>&,
llvm::DominatorTree&, llvm::LoopInfo&)
(/usr/local/clang-r275948/bin/clang-4.0+0x1dcfea6)
#6 0x0000000001dd238e llvm::formLCSSA(llvm::Loop&, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution*)
(/usr/local/clang-r275948/bin/clang-4.0+0x1dd238e)
#7 0x0000000001dd2daf llvm::formLCSSARecursively(llvm::Loop&,
llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution*)
(/usr/local/clang-r275948/bin/clang-4.0+0x1dd2daf)
#8 0x0000000001dd2d95 llvm::formLCSSARecursively(llvm::Loop&,
llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution*)
(/usr/local/clang-r275948/bin/clang-4.0+0x1dd2d95)
#9 0x0000000001dd2d95 llvm::formLCSSARecursively(llvm::Loop&,
llvm::DominatorTree&, llvm::LoopInfo*, llvm::ScalarEvolution*)
(/usr/local/clang-r275948/bin/clang-4.0+0x1dd2d95)
#10 0x0000000001deb5d7 llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned
int, bool, bool, bool, unsigned int, llvm::LoopInfo*, llvm::ScalarEvolution*,
llvm::DominatorTree*, llvm::AssumptionCache*, bool)
(/usr/local/clang-r275948/bin/clang-4.0+0x1deb5d7)
#11 0x0000000001c88060 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-r275948/bin/clang-4.0+0x1c88060)
#12 0x0000000001c8934c (anonymous
namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/usr/local/clang-r275948/bin/clang-4.0+0x1c8934c)
#13 0x0000000002659543 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-r275948/bin/clang-4.0+0x2659543)
#14 0x00000000019e38a3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-r275948/bin/clang-4.0+0x19e38a3)
#15 0x0000000002633ec7 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-r275948/bin/clang-4.0+0x2633ec7)
#16 0x00000000019e3fa8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-r275948/bin/clang-4.0+0x19e3fa8)
#17 0x0000000001ef7a5a clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-r275948/bin/clang-4.0+0x1ef7a5a)
#18 0x000000000252006f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-r275948/bin/clang-4.0+0x252006f)
#19 0x000000000288da4d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-r275948/bin/clang-4.0+0x288da4d)
#20 0x00000000025203ee clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-r275948/bin/clang-4.0+0x25203ee)
#21 0x000000000222ac3e clang::FrontendAction::Execute()
(/usr/local/clang-r275948/bin/clang-4.0+0x222ac3e)
#22 0x0000000002200416
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-r275948/bin/clang-4.0+0x2200416)
#23 0x00000000022b90f2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-r275948/bin/clang-4.0+0x22b90f2)
#24 0x0000000000b186e8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-r275948/bin/clang-4.0+0xb186e8)
#25 0x0000000000ac70cc main (/usr/local/clang-r275948/bin/clang-4.0+0xac70cc)
#26 0x00007fadb0aa4ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000b14754 _start (/usr/local/clang-r275948/bin/clang-4.0+0xb14754)
Stack dump:
0. Program arguments: /usr/local/clang-r275948/bin/clang-4.0 -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 /home/su/small.c -resource-dir
/usr/local/clang-r275948/bin/../lib/clang/4.0.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-r275948/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 135
-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 '%for.body'
clang-4.0: error: unable to execute command: Segmentation fault (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 275948)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-r275948/bin
clang-4.0: 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-4.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-6288a7.c
clang-4.0: note: diagnostic msg: /tmp/small-6288a7.sh
clang-4.0: note: diagnostic msg:
********************
$
---------------------------------------
int a, b, c, d, e, f;
void fn1 ()
{
int g = 0;
L1:
L2:
L3:
for (f = 0; f < 1; f++)
{
if (b)
{
if (a)
goto L3;
if (c)
goto L2;
continue;
}
if (d)
{
if (e)
{
g = 1;
if (a)
goto L3;
}
else
if (g)
continue;
}
goto L1;
}
}
--
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/20160721/3b6a2328/attachment-0001.html>
More information about the llvm-bugs
mailing list