<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 -Os crash in llvm/lib/Transforms/Vectorize/VPlan.cpp:269: llvm::Value* llvm::VPTransformState::get(llvm::VPValue*, const llvm::VPIteration&): Assertion `hasVectorValue(Def, Instance.Part)' failed"
href="https://bugs.llvm.org/show_bug.cgi?id=50009">50009</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang -Os crash in llvm/lib/Transforms/Vectorize/VPlan.cpp:269: llvm::Value* llvm::VPTransformState::get(llvm::VPValue*, const llvm::VPIteration&): Assertion `hasVectorValue(Def, Instance.Part)' failed
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haoxintu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hi all.
This small case makes the current trunk of clang crash only at -Os.
$cat small.c
#include <stdint.h>
int a, b, d, e;
int8_t c;
void f() {
int32_t *g = &a;
static i = 0;
uint32_t *j;
for (; b; b++) {
j = &i;
*j &= *g % e >= (a = c);
c -= 0 >= 0;
}
d = j;
}
$clang -w -Os small.c
clang-13:
/home/haoxin/haoxin-data/dut-research/compilers/llvm-project/llvm/lib/Transforms/Vectorize/VPlan.cpp:269:
llvm::Value* llvm::VPTransformState::get(llvm::VPValue*, const
llvm::VPIteration&): Assertion `hasVectorValue(Def, Instance.Part)' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments:
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj --mrelax-relocations
-disable-free -main-file-name small.c -mrelocation-model static
-mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/test-0416-clang
-resource-dir
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/lib/clang/13.0.0
-c-isystem /usr/local/include/csmith-2.3.0 -cxx-isystem
/usr/local/include/csmith-2.3.0 -internal-isystem
/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/lib/clang/13.0.0/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Os
-w
-fdebug-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/test-0416-clang
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops
-vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-f43b2f.o
-x c small.c
1. <eof> parser at end of file
2. Optimizer
#0 0x0000555bb03ad5cc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x35935cc)
#1 0x0000555bb03ab3d4 llvm::sys::RunSignalHandlers()
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x35913d4)
#2 0x0000555bb03ab543 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f5f31e9c980 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f5f30ac4fb7 raise
/build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f5f30ac6921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f5f30ab648a __assert_fail_base
/build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#7 0x00007f5f30ab6502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#8 0x0000555bb06066a7 llvm::VPTransformState::get(llvm::VPValue*,
llvm::VPIteration const&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x37ec6a7)
#9 0x0000555bb058fa1c
llvm::VPPredInstPHIRecipe::execute(llvm::VPTransformState&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3775a1c)
#10 0x0000555bb06069d1 llvm::VPBasicBlock::execute(llvm::VPTransformState*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x37ec9d1)
#11 0x0000555bb05fed00 llvm::VPRegionBlock::execute(llvm::VPTransformState*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x37e4d00)
#12 0x0000555bb060532d llvm::VPlan::execute(llvm::VPTransformState*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x37eb32d)
#13 0x0000555bb05a2395
llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&,
llvm::DominatorTree*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3788395)
#14 0x0000555bb05b3f42 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3799f42)
#15 0x0000555bb05b4586 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&, llvm::ProfileSummaryInfo*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x379a586)
#16 0x0000555bb05b519d llvm::LoopVectorizePass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x379b19d)
#17 0x0000555bb1378f61 llvm::detail::PassModel<llvm::Function,
llvm::LoopVectorizePass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x455ef61)
#18 0x0000555bafbb5fb5 llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x2d9bfb5)
#19 0x0000555bae220de1 llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
<span class="quote">>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)</span >
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x1406de1)
#20 0x0000555bafbb5a50 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x2d9ba50)
#21 0x0000555bae221431 llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x1407431)
#22 0x0000555bafbb4e75 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x2d9ae75)
#23 0x0000555bb0683b71 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#24 0x0000555bb068832d 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> >)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x386e32d)
#25 0x0000555bb1319326
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x44ff326)
#26 0x0000555bb1e8a149 clang::ParseAST(clang::Sema&, bool, bool)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x5070149)
#27 0x0000555bb13180e8 clang::CodeGenAction::ExecuteAction()
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x44fe0e8)
#28 0x0000555bb0ca2619 clang::FrontendAction::Execute()
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3e88619)
#29 0x0000555bb0c405a1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3e265a1)
#30 0x0000555bb0d6a440
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x3f50440)
#31 0x0000555badf8c574 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x1172574)
#32 0x0000555badf88a77 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#33 0x0000555badeb60f4 main
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x109c0f4)
#34 0x00007f5f30aa7bf7 __libc_start_main
/build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#35 0x0000555badf884da _start
(/media/haoxin/SeagateData/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin/clang-13+0x116e4da)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
f7c9de0de5804498085af973dc6bfc934a18f000)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/haoxin-data/dut-research/compilers/llvm-project/build-20210416/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/small-114d8e.c
clang-13: note: diagnostic msg: /tmp/small-114d8e.sh
clang-13: note: diagnostic msg:
********************
Reproduced on Godbolt: <a href="https://godbolt.org/z/TcnGaWKKT">https://godbolt.org/z/TcnGaWKKT</a>
Thanks,
Haoxin
</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>