<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 --- - clang crash emitting code for placement delete"
   href="https://llvm.org/bugs/show_bug.cgi?id=24889">24889</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crash emitting code for placement delete
          </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>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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ethan54@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=14911" name="attach_14911" title="Source file that reproduces the issue">attachment 14911</a> <a href="attachment.cgi?id=14911&action=edit" title="Source file that reproduces the issue">[details]</a></span>
Source file that reproduces the issue

Ubuntu clang version 3.8.0-svn247666-1~exp1 (trunk) (based on LLVM 3.8.0)

The following (also attached) reproduces the issue:

#include <new>

class Test {
public:
  Test() {}

  static void New() {
    char buf[1000];
    new (buf) Test;
  }

  static void operator delete(void*, void*) throw() {}
  static void operator delete(void*) throw() {}
};

int main(int argc, char** argv) {
  Test::New();
  return 0;
}

Compiling triggers a segfault:

0  libLLVM-3.8.so.1 0x00007fec5458fb58
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM-3.8.so.1 0x00007fec5458f016 llvm::sys::RunSignalHandlers() + 54
2  libLLVM-3.8.so.1 0x00007fec5458f17b
3  libpthread.so.0  0x00007fec52b15d10
4  clang            0x0000000000a11d65
clang::CodeGen::CodeGenFunction::EmitCall(clang::CodeGen::CGFunctionInfo
const&, llvm::Value*, clang::CodeGen::ReturnValueSlot,
clang::CodeGen::CallArgList const&, clang::\
Decl const*, llvm::Instruction**) + 8101
5  clang            0x0000000000a5aaa1
6  clang            0x0000000000a5e401
7  clang            0x0000000000a20110
8  clang            0x0000000000a21931
clang::CodeGen::CodeGenFunction::PopCleanupBlock(bool) + 4337
9  clang            0x0000000000a22353
clang::CodeGen::CodeGenFunction::DeactivateCleanupBlock(clang::CodeGen::EHScopeStack::stable_iterator,
llvm::Instruction*) + 147
10 clang            0x0000000000a625ec
clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(clang::CXXNewExpr const*) +
3708
11 clang            0x0000000000a7655c
12 clang            0x0000000000a76e70
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 64
13 clang            0x0000000000a413fa
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 90
14 clang            0x0000000000a4e9cf
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 47
15 clang            0x000000000092efba
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 202
16 clang            0x000000000092f3ff
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 95
17 clang            0x0000000000952e82
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 178
18 clang            0x0000000000959ca3
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 739
19 clang            0x000000000097f573
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 307
20 clang            0x000000000097f910
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 288
21 clang            0x000000000097fa82
clang::CodeGen::CodeGenModule::EmitDeferred() + 130
22 clang            0x000000000097fbc9 clang::CodeGen::CodeGenModule::Release()
+ 9
23 clang            0x00000000008da96e
24 clang            0x0000000000af178d clang::ParseAST(clang::Sema&, bool,
bool) + 893
25 clang            0x00000000007191ce clang::FrontendAction::Execute() + 302
26 clang            0x00000000006f2da9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 313
27 clang            0x00000000006da143
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1843
28 clang            0x00000000006d2440 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2336
29 clang            0x00000000006cfcc8 main + 1192
30 libc.so.6        0x00007fec52236a40 __libc_start_main + 240
31 clang            0x00000000006d14a9 _start + 41</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>