[llvm-bugs] [Bug 40938] New: opt crashes with "opt -newgvn -inline -licm -loop-extract -ipsccp -adce" : Assertion `CallSites.empty() && "Dangling pointers found in call sites map"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Mar 2 22:47:08 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40938
Bug ID: 40938
Summary: opt crashes with "opt -newgvn -inline -licm
-loop-extract -ipsccp -adce" : Assertion
`CallSites.empty() && "Dangling pointers found in call
sites map"' failed.
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: cszide at 163.com
CC: llvm-bugs at lists.llvm.org
Created attachment 21554
--> https://bugs.llvm.org/attachment.cgi?id=21554&action=edit
.bc file of the source code
Using godbolt (https://godbolt.org/), I find this bug can be reproduced by opt
7/truck version. The following is the output.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-7.0.0/bin/opt -o
/tmp/compiler-explorer-compiler11923-62-ad6yqc.vcsbl/output.s -S -newgvn
-inline -licm -loop-extract -ipsccp -adce <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'Aggressive Dead Code Elimination' on function '@main'
#0 0x000055a8103ff39a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x1fda39a)
#1 0x000055a8103fd914 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x1fd8914)
#2 0x000055a8103fda52 SignalHandler(int)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x1fd8a52)
#3 0x00007fa6913bb890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x000055a81014c480 (anonymous
namespace)::AggressiveDeadCodeElimination::markLive(llvm::Instruction*)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x1d27480)
#5 0x000055a81015591e (anonymous
namespace)::ADCELegacyPass::runOnFunction(llvm::Function&) (.part.342)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x1d3091e)
#6 0x000055a80fe1a1c9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x19f51c9)
#7 0x000055a80fe1a211 llvm::FPPassManager::runOnModule(llvm::Module&)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x19f5211)
#8 0x000055a80fe19700 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x19f4700)
#9 0x000055a80ea6d868 main
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x648868)
#10 0x00007fa690279b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#11 0x000055a80eb0c59a _start
(/opt/compiler-explorer/clang-7.0.0/bin/opt+0x6e759a)
/compiler-explorer/c-preload/compiler-wrapper: line 21: 14757 Segmentation
fault (core dumped) "$@"
Compiler returned: 139
But in my test environment, the outputs of the debug version and release
version are different.
$clang -v
clang version 9.0.0 (trunk 354742)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.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.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$clang -O3 -c -emit-llvm -mllvm -disable-llvm-optzns small.c -o small.bc
$opt(debug version) -newgvn -inline -licm -loop-extract -ipsccp -adce small.bc
-o small-opt.bc
opt:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:378:
bool {anonymous}::CGPassManager::RefreshCallGraph(const llvm::CallGraphSCC&,
llvm::CallGraph&, bool): Assertion `CallSites.empty() && "Dangling pointers
found in call sites map"' failed.
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt -newgvn -inline
-licm -loop-extract -ipsccp -adce small.bc -o small-opt.bc
1. Running pass 'CallGraph Pass Manager' on module 'small.bc'.
#0 0x0000558ff0e84b7b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:494:0
#1 0x0000558ff0e84c0e PrintStackTraceSignalHandler(void*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:558:0
#2 0x0000558ff0e82b92 llvm::sys::RunSignalHandlers()
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Signals.cpp:68:0
#3 0x0000558ff0e8459d SignalHandler(int)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:357:0
#4 0x00007f793d98b890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f793c63de97 gsignal
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f793c63f801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f793c62f39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#8 0x00007f793c62f412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x0000558fefca5a6d (anonymous
namespace)::CGPassManager::RefreshCallGraph(llvm::CallGraphSCC const&,
llvm::CallGraph&, bool)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:378:0
#10 0x0000558fefca5f92 (anonymous
namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&,
llvm::CallGraph&, bool&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:457:0
#11 0x0000558fefca619a (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:497:0
#12 0x0000558ff0605844 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1743:0
#13 0x0000558ff0605fd3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#14 0x0000558ff06061c5 llvm::legacy::PassManager::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1888:0
#15 0x0000558fee86315f main
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/tools/opt/opt.cpp:862:0
#16 0x00007f793c620b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#17 0x0000558fee824cba _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt+0x1808cba)
Aborted (core dumped)
$opt(release version) -newgvn -inline -licm -loop-extract -ipsccp -adce
small.bc -o small-opt.bc
Stack dump:
0. Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt -newgvn -inline
-licm -loop-extract -ipsccp -adce small.bc -o small-opt.bc
1. Running pass 'Function Pass Manager' on module 'small.bc'.
2. Running pass 'Aggressive Dead Code Elimination' on function '@main'
#0 0x00005596ad1d126a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x20d226a)
#1 0x00005596ad1cf244 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x20d0244)
#2 0x00005596ad1cf382 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x20d0382)
#3 0x00007f921ca15890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00005596aceffd70 (anonymous
namespace)::AggressiveDeadCodeElimination::markLive(llvm::Instruction*)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x1e00d70)
#5 0x00005596acf08dee (anonymous
namespace)::ADCELegacyPass::runOnFunction(llvm::Function&) (.part.362)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x1e09dee)
#6 0x00005596acb8e9a9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x1a8f9a9)
#7 0x00005596acb8ea31 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x1a8fa31)
#8 0x00005596acb8dd59 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x1a8ed59)
#9 0x00005596ab727b43 main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x628b43)
#10 0x00007f921b6aab97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#11 0x00005596ab7c683a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build3/bin/opt+0x6c783a)
Segmentation fault (core dumped)
The following is the source code of small.c
#include "csmith.h"
a, m;
b(c, d, e) { uint8_t f[5][2] = {}; }
g(h, i, r, j, k) { uint8_t l[5][2]; }
main() {
int32_t n;
int32_t o;
for (; m;)
p(b(g(q(), 0, p, p, a), n, o));
for (;;)
;
}
--
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/20190303/6b96159b/attachment-0001.html>
More information about the llvm-bugs
mailing list