<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": Assertion `ProcessedCount[V] < 100 && "Seem to have processed the same Value a lot"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=34472">34472</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes with "-mllvm -enable-newgvn": Assertion `ProcessedCount[V] < 100 && "Seem to have processed the same Value a lot"' failed
          </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>All
          </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>It happens at r312510.



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



$ clang-trunk -mllvm -enable-newgvn -O3 abc.c
clang-6.0: /home/absozero/trunk/llvm/lib/Transforms/Scalar/NewGVN.cpp:2853:
void {anonymous}::NewGVN::updateProcessedCount(const llvm::Value*): Assertion
`ProcessedCount[V] < 100 && "Seem to have processed the same Value a lot"'
failed.
#0 0x000000000232d56a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x232d56a)
#1 0x000000000232b6fe llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x232b6fe)
#2 0x000000000232b860 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x232b860)
#3 0x00007f5a5126e340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f5a5005fcc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5a500630d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f5a50058b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f5a50058c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002229c50 (anonymous
namespace)::NewGVN::updateProcessedCount(llvm::Value const*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2229c50)
#9 0x0000000002235a6e (anonymous
namespace)::NewGVN::iterateTouchedInstructions()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2235a6e)
#10 0x0000000002237598 (anonymous namespace)::NewGVN::runGVN()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2237598)
#11 0x0000000002239367 (anonymous
namespace)::NewGVNLegacyPass::runOnFunction(llvm::Function&) [clone .part.1772]
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2239367)
#12 0x0000000001eaa693 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1eaa693)
#13 0x000000000194fd26 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x194fd26)
#14 0x0000000001eaafaa llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1eaafaa)
#15 0x00000000024cd275 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x24cd275)
#16 0x00000000024ce653 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-6.0+0x24ce653)
#17 0x0000000002cf1d5f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2cf1d5f)
#18 0x0000000002f1533c clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2f1533c)
#19 0x0000000002cf1200 clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2cf1200)
#20 0x0000000002882fe6 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2882fe6)
#21 0x0000000002855c46
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2855c46)
#22 0x000000000291eba2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x291eba2)
#23 0x0000000000d47dc8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xd47dc8)
#24 0x0000000000cd51ac main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xcd51ac)
#25 0x00007f5a5004aec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#26 0x0000000000d436e9 _start
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xd436e9)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-6.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
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/6.0.0 -c-isystem
/usr/local/include/csmith-2.3.0 -c-isystem . -cxx-isystem
/usr/local/include/csmith-2.3.0 -cxx-isystem . -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/6.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 -ferror-limit 19
-fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn -o
/tmp/abc-fa1587.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-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 312510)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.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, and
associated run script.
clang-6.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-6.0: note: diagnostic msg: /tmp/abc-cc2508.c
clang-6.0: note: diagnostic msg: /tmp/abc-cc2508.sh
clang-6.0: note: diagnostic msg:

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


$ cat abc.c
char a, f;
int b, c;
long d, e, g, h, i;
void fn1() {
  char j = 0;
  for (; b <= 3; b++)
    for (; a;) {
      long k;
      for (; k <= 3;)
        for (; i;) {
          h = 9;
          for (; h <= 65;) {
            k = j ?: (e = c);
            h &= d < 1;
            if (h)
              ;
            else
              for (;;)
                ;
          }
        l1:;
        }
    }
  for (;;) {
    for (; g;) {
      a = j % g % j;
      goto l1;
    }
    j = 9;
    for (; f;)
      ;
  }
}</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>