<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - frontend segfault with clang-3.6 -g -std=c++14 -fsanitize=memory -O2"
   href="https://llvm.org/bugs/show_bug.cgi?id=25815">25815</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>frontend segfault with clang-3.6 -g -std=c++14 -fsanitize=memory -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bsilver16384+llvm@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15436" name="attach_15436" title="preprocessed source code">attachment 15436</a> <a href="attachment.cgi?id=15436&action=edit" title="preprocessed source code">[details]</a></span>
preprocessed source code

Clang crashes when compiling gperftools with "-g -std=c++14 -fsanitize=memory
-O2". I simplified the relevant source file a lot, and the only interesting
part I see is defining a custom "void operator delete(void* p) throw()".

I can reproduce the crash with the official clang-3.6.2 build and Debian's
version 1:3.6.2~svn240577-1~exp1, but not the official 3.7.0 build.

$ /tmp/new_clang/clang+llvm-3.6.2-x86_64-linux-gnu-ubuntu-14.04/bin/clang -g
-std=c++14 -fsanitize=memory -O2 -c /tmp/tcmalloc.cc -o /tmp/tcmalloc.o
0  clang           0x00000000024482f8 llvm::sys::PrintStackTrace(_IO_FILE*) +
40
1  clang           0x000000000244973b
2  libpthread.so.0 0x00007f82592cf8d0
3  clang           0x0000000001e3d6e9 llvm::DwarfUnit::addType(llvm::DIE&,
llvm::DIType, llvm::dwarf::Attribute) + 25
4  clang           0x0000000001e549b9
llvm::DwarfCompileUnit::applyVariableAttributes(llvm::DbgVariable const&,
llvm::DIE&) + 249
5  clang           0x0000000001e23a3f
llvm::DwarfDebug::finishVariableDefinitions() + 47
6  clang           0x0000000001e23f04 llvm::DwarfDebug::finalizeModuleInfo() +
100
7  clang           0x0000000001e2470f llvm::DwarfDebug::endModule() + 47
8  clang           0x0000000001e16d15
llvm::AsmPrinter::doFinalization(llvm::Module&) + 1829
9  clang           0x00000000023e1978
llvm::FPPassManager::doFinalization(llvm::Module&) + 72
10 clang           0x00000000023e1d77
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 999
11 clang           0x00000000008f05fd
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
7773
12 clang           0x00000000008e64ab
13 clang           0x0000000000a6a2a3 clang::ParseAST(clang::Sema&, bool, bool)
+ 483
14 clang           0x0000000000716c79 clang::FrontendAction::Execute() + 57
15 clang           0x00000000006eba03
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 803
16 clang           0x00000000006d1e5b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2795
17 clang           0x00000000006c9b7e cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 702
18 clang           0x00000000006d0b82 main + 11506
19 libc.so.6       0x00007f8258512b45 __libc_start_main + 245
20 clang           0x00000000006c97f1
Stack dump:
0.    Program arguments:
/tmp/new_clang/clang+llvm-3.6.2-x86_64-linux-gnu-ubuntu-14.04/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-main-file-name tcmalloc.cc -mrelocation-model pic -pic-level 2 -pie-level 2
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-momit-leaf-frame-pointer -g -dwarf-column-info -coverage-file /tmp/tcmalloc.o
-resource-dir
/tmp/new_clang/clang+llvm-3.6.2-x86_64-linux-gnu-ubuntu-14.04/bin/../lib/clang/3.6.2
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/tmp/new_clang/clang+llvm-3.6.2-x86_64-linux-gnu-ubuntu-14.04/bin/../lib/clang/3.6.2/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-std=c++14 -fdeprecated-macro -fdebug-compilation-dir
/home/brian/Desktop/peloton-tech-code -ferror-limit 19 -fmessage-length 211
-fsanitize=memory -fno-assume-sane-operator-new -mstackrealign
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-vectorize-loops -vectorize-slp -o /tmp/tcmalloc.o -x c++ /tmp/tcmalloc.cc 
1.    <eof> parser at end of file
2.    Code generation
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: 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: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/tcmalloc-e2e0f7.cpp
clang: note: diagnostic msg: /tmp/tcmalloc-e2e0f7.sh
clang: note: diagnostic msg: 

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