[llvm-bugs] [Bug 33120] New: clang crashes with "-mllvm -enable-newgvn": "Seem to have processed the same Value a lot"

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 21 22:27:03 PDT 2017


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

            Bug ID: 33120
           Summary: clang crashes with "-mllvm -enable-newgvn": "Seem to
                    have processed the same Value a lot"
           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

The same crash still persists at r303525, after the patches for Bug 32838 and
Bug 33116.

The following code crashes the current trunk version at "-O2" and above with
"-mllvm -enable-newgvn". Level "-O1" works fine.


$ clang-trunk --version
clang version 5.0.0 (trunk 303525)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

$ clang-trunk -O2 -mllvm -enable-newgvn abc.c
abc.c:13:17: warning: incompatible pointer to integer conversion initializing
'short' with an expression of type 'short **' [-Wint-conversion]
          short g = &f;
                ^   ~~
clang-5.0: /home/absozero/trunk/llvm/lib/Transforms/Scalar/NewGVN.cpp:2703:
void {anonymous}::NewGVN::updateProcessedCount(const llvm::Value*): Assertion
`ProcessedCount[V] < 100 && "Seem to have processed the same Value a lot"'
failed.
#0 0x000000000216b41a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x216b41a)
#1 0x00000000021692ae llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x21692ae)
#2 0x0000000002169402 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x2169402)
#3 0x00007fe88f598330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fe88e115c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fe88e119028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fe88e10ebf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fe88e10eca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000000a31364 bool llvm::isa<llvm::VectorType, llvm::Type*>(llvm::Type*
const&) [clone .isra.48] [clone .part.49]
(/home/absozero/trunk/root-clang/bin/clang-5.0+0xa31364)
#9 0x000000000206769e (anonymous
namespace)::NewGVN::iterateTouchedInstructions()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x206769e)
#10 0x0000000002069ff8 (anonymous namespace)::NewGVN::runGVN() [clone
.constprop.1280] (/home/absozero/trunk/root-clang/bin/clang-5.0+0x2069ff8)
#11 0x000000000206bf47 NewGVNLegacyPass::runOnFunction(llvm::Function&) [clone
.part.1274] [clone .constprop.1278]
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x206bf47)
#12 0x0000000001cda6f3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1cda6f3)
#13 0x0000000002b2c01e (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x2b2c01e)
#14 0x0000000001cda28d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x1cda28d)
#15 0x0000000002312b8e 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+0x2312b8e)
#16 0x00000000029c7e57
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x29c7e57)
#17 0x0000000002d73318 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x2d73318)
#18 0x00000000029c726c clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x29c726c)
#19 0x00000000026980a6 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x26980a6)
#20 0x000000000266a72e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x266a72e)
#21 0x000000000272233b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-5.0+0x272233b)
#22 0x0000000000c39ab8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-5.0+0xc39ab8)
#23 0x0000000000bce486 main
(/home/absozero/trunk/root-clang/bin/clang-5.0+0xbce486)
#24 0x00007fe88e100f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#25 0x0000000000c361f9 _start
(/home/absozero/trunk/root-clang/bin/clang-5.0+0xc361f9)
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 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn -o
/tmp/abc-49ef86.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 303525)
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-f69d8d.c
clang-5.0: note: diagnostic msg: /tmp/abc-f69d8d.sh
clang-5.0: note: diagnostic msg:

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


$ cat abc.c
int a, b, d;
long c;
char e;
void fn1() {
  if (a)
    for (; c;) {
      a = 7;
      for (; a; d++)
        ;
      short *f;
      for (; *f; f++)
        if (e) {
          short g = &f;
        l1:
          b = g;
        }
    }
  goto l1;
}

-- 
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/20170522/1fb18bf3/attachment.html>


More information about the llvm-bugs mailing list