<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 - crash in MemorySSA"
   href="https://bugs.llvm.org/show_bug.cgi?id=33626">33626</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash in MemorySSA
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matthias.krueger@famsik.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18729" name="attach_18729" title="files clang told to attach">attachment 18729</a> <a href="attachment.cgi?id=18729&action=edit" title="files clang told to attach">[details]</a></span>
files clang told to attach

There's a crash happening sometimes in MemorySSA when compiling the attached
code at -O3.

It does not always crash for some reason, only one in 10 times crashes for me
(with the reduced version)

I hope I didn't butcher the code too much while trying to reduce.

The binary used is an optimized clang/llvm build (selfhost).
While doing this selfhost, there was no crash to be seen though.


#0 0x0000000001a89a59 PrintStackTraceSignalHandler(void*)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x1a89a59)
#1 0x0000000001a88b56 SignalHandler(int)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x1a88b56)
#2 0x00007f6f676c55b0 __restore_rt (/lib64/libpthread.so.0+0x115b0)
#3 0x000000000189fdf0 llvm::MemorySSA::OptimizeUses::optimizeUses()
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x189fdf0)
#4 0x000000000189e321 llvm::MemorySSA::buildMemorySSA()
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x189e321)
#5 0x000000000189ddfe
llvm::MemorySSAWrapperPass::runOnFunction(llvm::Function&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x189ddfe)
#6 0x0000000001626026 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x1626026)
#7 0x000000000155b22b (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x155b22b)
#8 0x0000000001626e0c llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x1626e0c)
#9 0x0000000001f21bc9 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/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x1f21bc9)
#10 0x0000000003f569c9
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x3f569c9)
#11 0x000000000297e3d4 clang::ParseAST(clang::Sema&, bool, bool)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x297e3d4)
#12 0x00000000021cf0c9 clang::FrontendAction::Execute()
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x21cf0c9)
#13 0x000000000214f838
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x214f838)
#14 0x000000000226972e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0x226972e)
#15 0x0000000000f86b04 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0xf86b04)
#16 0x0000000000f8584e main
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0xf8584e)
#17 0x00007f6f66218401 __libc_start_main (/lib64/libc.so.6+0x20401)
#18 0x0000000000f8202a _start
(/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0+0xf8202a)
Stack dump:
0.      Program arguments:
/home/matthias/LLVM/LLVM_dev/stage_2/build/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name suppressions.cpp -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 -coverage-notes-file
/home/matthias/vcs/github/cppcheck/lib/suppressions.gcno -resource-dir
/home/matthias/LLVM/LLVM_dev/stage_2/build/lib/clang/5.0.0 -I lib -I
externals/simplecpp -I externals/tinyxml -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/backward
-internal-isystem /usr/local/include -internal-isystem
/home/matthias/LLVM/LLVM_dev/stage_2/build/lib/clang/5.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-std=c++0x -fdeprecated-macro -fdebug-compilation-dir
/home/matthias/vcs/github/cppcheck -ferror-limit 19 -fmessage-length 316
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o lib/suppressions.o -x
c++ lib/suppressions.cpp 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'lib/suppressions.cpp'.
4.      Running pass 'Memory SSA' on function
'@_ZNSt11_Deque_baseISt4pairIPKcS2_ESaIS3_EE17_M_initialize_mapEm'
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (/home/matthias/LLVM/LLVM_dev/stage_1//llvm/tools/clang
ddb61cae6a5e7f3f0bc5da4290334368d03da2a0)
(/home/matthias/LLVM/LLVM_dev/stage_1//llvm
7a4e530f9e9c0e4bb287b6dc8fdee0eadc34e885)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/matthias/LLVM/LLVM_dev/stage_2/build/bin
clang-5.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-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/suppressions-e4bd4b.cpp
clang-5.0: note: diagnostic msg: /tmp/suppressions-e4bd4b.sh
clang-5.0: note: diagnostic msg: 

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



Original code from github.com/danmar/cppcheck @ 15b0eb4 invocated as
clang++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml   -O3 -std=c++0x  -c -o
lib/suppressions.o lib/suppressions.cpp

LLVM @ 7a4e530f9e9c0e4bb287b6dc8fdee0eadc34e885 / trunk@306557
clang @ ddb61cae6a5e7f3f0bc5da4290334368d03da2a0 / trunk@306555 

Manually (somewhat-)reduced c++ snippet is attached in form of the sources
clang throws into /tmp after crashing.

Thanks</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>