[llvm-bugs] [Bug 38259] New: clang crashes with "-mllvm -enable-newgvn" at -O3: Assertion `User && To != User' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 21 21:31:51 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38259

            Bug ID: 38259
           Summary: clang crashes with "-mllvm -enable-newgvn" at -O3:
                    Assertion `User && To != User' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            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

clang-r312506: first working build
clang-r312510: next failing build



$ clang-trunk -v
clang version 7.0.0 (trunk 337641)
Target: x86_64-unknown-linux-gnu
Thread model: posix


$ clang-trunk -mllvm -enable-newgvn -O3 abc.c
abc.c:17:12: warning: incompatible pointer to integer conversion initializing
'char' with an expression of type 'short (short)' [-Wint-conversion]
      char p = l;
           ^   ~
clang-7: /home/absozero/trunk/llvm/lib/Transforms/Scalar/NewGVN.cpp:2083: void
(anonymous namespace)::NewGVN::addAdditionalUsers(llvm::Value *, llvm::Value *)
const: Assertion `User && To != User' failed.
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-7 -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
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 171 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn -o
/tmp/abc-6ab3d9.o -x c abc.c -faddrsig
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 '@n'
#0 0x00000000020c9d34 PrintStackTraceSignalHandler(void*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x20c9d34)
#1 0x00000000020c7bbe llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-7+0x20c7bbe)
#2 0x00000000020c9ef2 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-7+0x20c9ef2)
#3 0x00007f5a72d8d330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f5a71968c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5a7196c028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f5a71961bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f5a71961ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001fa5072 (anonymous
namespace)::NewGVN::checkSimplificationResults(llvm::GVNExpression::Expression*,
llvm::Instruction*, llvm::Value*) const
(/home/absozero/trunk/root-clang/bin/clang-7+0x1fa5072)
#9 0x0000000001fa3aba (anonymous
namespace)::NewGVN::createExpression(llvm::Instruction*) const
(/home/absozero/trunk/root-clang/bin/clang-7+0x1fa3aba)
#10 0x0000000001f8ee91 (anonymous
namespace)::NewGVN::iterateTouchedInstructions()
(/home/absozero/trunk/root-clang/bin/clang-7+0x1f8ee91)
#11 0x0000000001f87afe (anonymous namespace)::NewGVN::runGVN()
(/home/absozero/trunk/root-clang/bin/clang-7+0x1f87afe)
#12 0x0000000001f8d89a (anonymous
namespace)::NewGVNLegacyPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1f8d89a)
#13 0x0000000001b87f43 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b87f43)
#14 0x00000000015b6bdd (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x15b6bdd)
#15 0x0000000001b88662 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b88662)
#16 0x0000000002299258 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-7+0x2299258)
#17 0x0000000002bd7ff5
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2bd7ff5)
#18 0x000000000317a805 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-7+0x317a805)
#19 0x000000000274d7a0 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-7+0x274d7a0)
#20 0x00000000026f5ff1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x26f5ff1)
#21 0x00000000027f0fe9
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x27f0fe9)
#22 0x0000000000923e28 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-7+0x923e28)
#23 0x000000000092166a main
(/home/absozero/trunk/root-clang/bin/clang-7+0x92166a)
#24 0x00007f5a71953f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#25 0x000000000091e5bd _start
(/home/absozero/trunk/root-clang/bin/clang-7+0x91e5bd)
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 337641)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7: note: diagnostic msg: /tmp/abc-6f2509.c
clang-7: note: diagnostic msg: /tmp/abc-6f2509.sh
clang-7: note: diagnostic msg:

********************


$ cat abc.c
short a, b, d, e;
int c, f, h, i, j;
long g;
char k;
short(l)(short m) { return m >> c; }
void n() {
  int o[9];
  i = 0;
  for (; i < 9; i++)
    o[i] = 0;
  h = 4;
  for (; h >= 0; h--) {
    g = 1;
    for (; g <= 4; g++) {
      e = b == 0 ?: a / b;
      d = l(e<o[h + 3]> o[g]) > f;
      char p = l;
      k = p + d;
      j ^= k;
    }
  }
}

-- 
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/20180722/db85be4e/attachment.html>


More information about the llvm-bugs mailing list