<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 with "-mllvm -enable-newgvn": lots of "singleReachablePHIPath" in the stack trace"
href="https://bugs.llvm.org/show_bug.cgi?id=33014">33014</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes with "-mllvm -enable-newgvn": lots of "singleReachablePHIPath" in the stack trace
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>helloqirun@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following code crashes the current trunk version at "-O3" and above with
"-mllvm -enable-newgvn".
$ clang-trunk -v
clang version 5.0.0 (trunk 302779)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.1.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/3.4.6
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.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.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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ clang-trunk -mllvm -enable-newgvn abc.c -O3
abc.c:19:12: warning: incompatible pointer to integer conversion initializing
'char' with an expression of type 'long *' [-Wint-conversion]
char g = f = &c;
^ ~~~~~~
#0 0x0000000001c876b4 PrintStackTraceSignalHandler(void*)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1c876b4)
#1 0x0000000001c879e6 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1c879e6)
#2 0x00007fa130e28330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x0000000001b86201 bool
llvm::DenseMapBase<llvm::DenseMap<llvm::BasicBlockEdge,
llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::Basi\
cBlockEdge>, llvm::detail::DenseSetPair<llvm::BasicBlockEdge> >,
llvm::BasicBlockEdge, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::\
BasicBlockEdge>, llvm::detail::DenseSetPair<llvm::BasicBlockEdge>
<span class="quote">>::LookupBucketFor<llvm::BasicBlockEdge>(llvm::BasicBlockEdge const&, llvm:\</span >
:detail::DenseSetPair<llvm::BasicBlockEdge> const*&) const
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1b86201)
#4 0x0000000001b941d3 llvm::filter_iterator<llvm::Use const*, (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*\
, llvm::MemoryAccess const*) const::$_12>::findNextValid()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1b941d3)
#5 0x0000000001b93c85 (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*,
llvm::MemoryAccess const*) const (/hom\
e/absozero/trunk/root-clang/bin/clang-5.0+0x1b93c85)
#6 0x0000000001b93de8 (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*,
llvm::MemoryAccess const*) const (/hom\
e/absozero/trunk/root-clang/bin/clang-5.0+0x1b93de8)
<snipped..>
#253 0x0000000001b93de8 (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*,
llvm::MemoryAccess const*) const (/h\
ome/absozero/trunk/root-clang/bin/clang-5.0+0x1b93de8)
#254 0x0000000001b93de8 (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*,
llvm::MemoryAccess const*) const (/h\
ome/absozero/trunk/root-clang/bin/clang-5.0+0x1b93de8)
#255 0x0000000001b93de8 (anonymous
namespace)::NewGVN::singleReachablePHIPath(llvm::MemoryAccess const*,
llvm::MemoryAccess const*) const (/h\
ome/absozero/trunk/root-clang/bin/clang-5.0+0x1b93de8)
Stack dump:
0. Program arguments: /home/absozero/trunk/root-clang/bin/clang-5.0 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-\
file-name abc.c -mrelocation-model static -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-ar\
ray -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info
-debugger-tuning=gdb -resource-dir /home/absozero/trunk/root-clang/lib/cl\
ang/5.0.0 -internal-isystem /usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/5.0.0/include -internal-externc-is\
ystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir /ho\
me/absozero/projects/reduction/crash -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vecto\
rize-slp -mllvm -enable-newgvn -o /tmp/abc-671985.o -x c abc.c
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'CallGraph Pass Manager' on module 'abc.c'.
4. Running pass 'Global Value Numbering' on function '@fn1'
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 302779)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: 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, an\
d associated run script.
clang-5.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-5.0: note: diagnostic msg: /tmp/abc-93802c.c
clang-5.0: note: diagnostic msg: /tmp/abc-93802c.sh
clang-5.0: note: diagnostic msg:
********************
$ cat abc.c
unsigned a;
short b;
long c, d;
char e = 8;
void fn1() {
long *f = &d;
if (a) {
d = 5;
for (; d;) {
*f = 1;
for (; *f;) {
(c /= *f) ? b ?: (c = 8) : (*f = e);
e = 0;
}
l1:;
}
*f = 4;
for (; *f;) {
char g = f = &c;
goto l1;
for (; g; g += 1) {
short *h;
*h = 4;
l2:;
}
}
}
goto l2;
}</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>