<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang crashes on valid code at -O3 on x86_64-linux-gnu: Assertion `!Cost->fol dTailByMasking() && "Cannot check stride when folding tail"' failed"
href="https://bugs.llvm.org/show_bug.cgi?id=39497">39497</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes on valid code at -O3 on x86_64-linux-gnu: Assertion `!Cost->fol dTailByMasking() && "Cannot check stride when folding tail"' failed
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>su@cs.ucdavis.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Tested with trunk revision 345488.
$ clangpolly -v
clang version 8.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
8029b38886dd239769e3501dac21438e16886ce8) (llvm/trunk 345488)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/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.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
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.4
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.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
$
$ clangpolly -O2 small.c
$
$ clangpolly -O3 small.c
clang-6.0:
/home/su/software/tmp/polly/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2519:
void llvm::InnerLoopVectorizer::emitSCEVChecks(llvm::Loop*, llvm::BasicBlock*):
Assertion `!Cost->foldTailByMasking() && "Cannot check stride when folding
tail"' failed.
Stack dump:
0. Program arguments: /home/su/software/tmp/polly/llvm_build/bin/clang-6.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 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -resource-dir
/home/su/software/tmp/polly/llvm_build/lib/clang/8.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/8.0.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/su/specres/good/20181026-clangpolly-m64-O3-build-114556/delta
-ferror-limit 19 -fmessage-length 97 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-026d76.o -x c small.c -faddrsig
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'Function Pass Manager' on module 'small.c'.
4. Running pass 'Loop Vectorization' on function '@main'
#0 0x000000000280907a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x280907a)
#1 0x000000000280771a llvm::sys::RunSignalHandlers()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x280771a)
#2 0x0000000002807851 SignalHandler(int)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2807851)
#3 0x00007f39f41e3330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f39f2fcbc37 gsignal
/build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f39f2fcf028 abort
/build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f39f2fc4bf6 __assert_fail_base
/build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f39f2fc4ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000291c2e9 llvm::InnerLoopVectorizer::emitSCEVChecks(llvm::Loop*,
llvm::BasicBlock*)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x291c2e9)
#9 0x000000000292d1c8 llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x292d1c8)
#10 0x00000000029389e8
llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&,
llvm::DominatorTree*)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x29389e8)
#11 0x000000000293f080 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x293f080)
#12 0x000000000294052c llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x294052c)
#13 0x0000000002940b66 (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2940b66)
#14 0x00000000022e8292 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x22e8292)
#15 0x00000000022e84dc llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x22e84dc)
#16 0x00000000022e8c06 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x22e8c06)
#17 0x00000000029d8625 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x29d8625)
#18 0x00000000029d9c0f clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, 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> >)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x29d9c0f)
#19 0x00000000032caccc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x32caccc)
#20 0x00000000038d4895 clang::ParseAST(clang::Sema&, bool, bool)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x38d4895)
#21 0x00000000032ca041 clang::CodeGenAction::ExecuteAction()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x32ca041)
#22 0x0000000002e33a66 clang::FrontendAction::Execute()
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2e33a66)
#23 0x0000000002e04576
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2e04576)
#24 0x0000000002ede094
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0x2ede094)
#25 0x0000000000e5d308 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xe5d308)
#26 0x0000000000dce7b5 main
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xdce7b5)
#27 0x00007f39f2fb6f45 __libc_start_main
/build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0
#28 0x0000000000e581c9 _start
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xe581c9)
clang-6: error: unable to execute command: Aborted (core dumped)
clang-6: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
8029b38886dd239769e3501dac21438e16886ce8) (llvm/trunk 345488)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
clang-6: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-6: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6: note: diagnostic msg: /tmp/small-75501a.c
clang-6: note: diagnostic msg: /tmp/small-75501a.sh
clang-6: note: diagnostic msg:
********************
$
----------------------------------
int a, b;
int main ()
{
unsigned short d;
while (1)
for (d = 0; d < 4; d += 1)
{
b &= d + 1;
if (!a)
return 0;
}
return 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>