<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 (-O2 and above) at lib/CodeGen/RegisterCoalescer.cpp:2707 Assertion `(TrackSubRegLiveness || V.RedefVNI) && "Instruction is reading nonexistent value"' failed"
href="https://bugs.llvm.org/show_bug.cgi?id=51830">51830</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes (-O2 and above) at lib/CodeGen/RegisterCoalescer.cpp:2707 Assertion `(TrackSubRegLiveness || V.RedefVNI) && "Instruction is reading nonexistent value"' 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>Linux
</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>Common Code Generator Code
</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.
$cat small.c
#include <stdint.h>
int a, b, c, d, e, f, g, i;
fn1() {
uint16_t j;
uint8_t *k;
for (; a; a++) {
if (e) {
if ((e = j) ? d : 0) {
j = a;
k = &j;
e ^= b + b;
}
c = g;
}
j *= f;
for (; b; b++)
;
}
for (d = 4; d <= 83; d++)
k = &e;
*k %= i;
}
$clang -w -m32 -O2 small.c (same as -O3 and -Os)
clang-14:
/home/haoxin/haoxin-data/compilers/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp:2707:
{anonymous}::JoinVals::ConflictResolution
{anonymous}::JoinVals::analyzeValue(unsigned int, {anonymous}::JoinVals&):
Assertion `(TrackSubRegLiveness || V.RedefVNI) && "Instruction is reading
nonexistent value"' 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:
/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14 -cc1 -triple
i386-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 -target-cpu pentium4
-tune-cpu generic -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/20210819/5
-resource-dir
/home/haoxin/haoxin-data/compilers/llvm-project/build/lib/clang/14.0.0
-internal-isystem
/home/haoxin/haoxin-data/compilers/llvm-project/build/lib/clang/14.0.0/include
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Os
-w
-fdebug-compilation-dir=/home/haoxin/haoxin-data/dut-research/covsmith-test/20210819/5
-ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops
-vectorize-slp -faddrsig -o /tmp/small-55019d.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 'Simple Register Coalescing' on function '@fn1'
#0 0x0000564593633404 PrintStackTraceSignalHandler(void*)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x3b80404)
#1 0x0000564593630b1e SignalHandler(int)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x3b7db1e)
#2 0x00007f6bc37853c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#3 0x00007f6bc322418b raise
/build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#4 0x00007f6bc3203859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
#5 0x00007f6bc3203729 get_sysdep_segment_value
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
#6 0x00007f6bc3203729 _nl_load_domain
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
#7 0x00007f6bc3214f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#8 0x00005645929818bc (anonymous
namespace)::JoinVals::computeAssignment(unsigned int, (anonymous
namespace)::JoinVals&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2ece8bc)
#9 0x0000564592981931 (anonymous namespace)::JoinVals::mapValues((anonymous
namespace)::JoinVals&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2ece931)
#10 0x000056459298a0e0 (anonymous
namespace)::RegisterCoalescer::joinVirtRegs(llvm::CoalescerPair&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2ed70e0)
#11 0x000056459298bdfb (anonymous
namespace)::RegisterCoalescer::joinCopy(llvm::MachineInstr*, bool&)
(.constprop.0)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2ed8dfb)
#12 0x000056459298e022 (anonymous
namespace)::RegisterCoalescer::copyCoalesceWorkList(llvm::MutableArrayRef<llvm::MachineInstr*>)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2edb022)
#13 0x0000564592991855 (anonymous
namespace)::RegisterCoalescer::runOnMachineFunction(llvm::MachineFunction&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2ede855)
#14 0x00005645927e01e8
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x2d2d1e8)
#15 0x0000564592cd2395 llvm::FPPassManager::runOnFunction(llvm::Function&)
(.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x321f395)
#16 0x0000564592cd25d9 llvm::FPPassManager::runOnModule(llvm::Module&)
(.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x321f5d9)
#17 0x0000564592cd36c2 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x32206c2)
#18 0x00005645939783b8 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x3ec53b8)
#19 0x000056459397bf35 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x3ec8f35)
#20 0x00005645947f4d6f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x4d41d6f)
#21 0x0000564595537799 clang::ParseAST(clang::Sema&, bool, bool) (.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x5a84799)
#22 0x00005645947f38a8 clang::CodeGenAction::ExecuteAction() (.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x4d408a8)
#23 0x0000564594077ec9 clang::FrontendAction::Execute()
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x45c4ec9)
#24 0x000056459400912e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (.localalias)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x455612e)
#25 0x00005645941583e0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x46a53e0)
#26 0x0000564590e1483d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x136183d)
#27 0x0000564590e10a98 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x135da98)
#28 0x0000564590d44b59 main
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x1291b59)
#29 0x00007f6bc32050b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#30 0x0000564590e1060e _start
(/home/haoxin/haoxin-data/compilers/llvm-project/build/bin/clang-14+0x135d60e)
clang-14: error: unable to execute command: Aborted (core dumped)
clang-14: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
4e408aae2c55a8fd71b5a96eb86db350a7acc443)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/haoxin-data/compilers/llvm-project/build/bin
clang-14: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-14: note: diagnostic msg: /tmp/small-bcd439.c
clang-14: note: diagnostic msg: /tmp/small-bcd439.sh
clang-14: note: diagnostic msg:
********************
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>