[llvm-bugs] [Bug 32849] New: clang crashes with "-mllvm -enable-newgvn": "Any class with a store as a " "leader should have a " "representative stored value\n"
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 28 13:37:51 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32849
Bug ID: 32849
Summary: clang crashes with "-mllvm -enable-newgvn": "Any class
with a store as a " "leader should have a "
"representative stored value\n"
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: helloqirun at gmail.com
CC: llvm-bugs at lists.llvm.org
The following code crashes the current trunk version at "-O2" and above with
"-mllvm -enable-newgvn". Level "-O1" works fine.
$ clang-trunk -v
clang version 5.0.0 (trunk 301630)
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 -O2 -mllvm -enable-newgvn abc.c
abc.c:13:24: warning: use of logical '&&' with constant operand
[-Wconstant-logical-operand]
d += (*e += c) && 7;
^ ~
abc.c:13:24: note: use '&' for a bitwise operation
d += (*e += c) && 7;
^~
&
abc.c:13:24: note: remove constant to silence this warning
d += (*e += c) && 7;
~^~~~
clang-5.0: /home/absozero/trunk/llvm/lib/Transforms/Scalar/NewGVN.cpp:2502:
void (anonymous namespace)::NewGVN::verifyMemoryCongruency() const: Assertion
`(CC->getStoredValue() || !isa<StoreInst>(CC->getLeader())) && "Any class with
a store as a " "leader should have a " "representative stored value\n"' failed.
#0 0x0000000001c049a4 PrintStackTraceSignalHandler(void*)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1c049a4)
#1 0x0000000001c04cd6 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1c04cd6)
#2 0x00007faec2ff8330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007faec1b75c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007faec1b79028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007faec1b6ebf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#6 0x00007faec1b6eca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x0000000001af8abd (anonymous namespace)::NewGVN::runGVN()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1af8abd)
#8 0x0000000001af3976 NewGVNLegacyPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1af3976)
#9 0x00000000017ab40f llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x17ab40f)
#10 0x00000000025eada6 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x25eada6)
#11 0x00000000017abb65 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x17abb65)
#12 0x0000000001d8beeb 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/absozero/trunk/root-clang/bin/clang-5.0+0x1d8beeb)
#13 0x000000000247a527
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x247a527)
#14 0x00000000028d8096 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x28d8096)
#15 0x000000000215b088 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x215b088)
#16 0x000000000210e421
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x210e421)
#17 0x00000000021dd1cd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x21dd1cd)
#18 0x000000000083930c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-5.0+0x83930c)
#19 0x00000000008372a5 main
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x8372a5)
#20 0x00007faec1b60f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#21 0x0000000000834459 _start
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x834459)
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-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/home/absozero/trunk/root-clang/lib/clang/5.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/5.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 142 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn -o
/tmp/abc-7891c1.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: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 301630)
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
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
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-4ebff3.c
clang-5.0: note: diagnostic msg: /tmp/abc-4ebff3.sh
clang-5.0: note: diagnostic msg:
********************
$ cat abc.c
char a;
long b;
short c;
void fn1() {
for (;;) {
long d;
l1:
if (4 != d) {
long *e = &d;
if (d) {
goto l1;
l2:
d += (*e += c) && 7;
}
b = 0;
}
if (a)
goto l2;
}
}
--
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/20170428/4f414fc7/attachment-0001.html>
More information about the llvm-bugs
mailing list