[LLVMbugs] [Bug 11339] New: clang++ crashes on explicit destructor call with incorrect class-name (in function template)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 8 11:47:05 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11339

             Bug #: 11339
           Summary: clang++ crashes on explicit destructor call with
                    incorrect class-name (in function template)
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: olov.lassus at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


~/projects/c++ % clang -v
Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix


~/projects/c++ % cat clang_crash.cc 
template<class T>
void destroy(T* p) {
  p->~T(); // ok
  p->~oops(); // clang++ should error, not crash
}
int main() {
  destroy(new int);
  return 0;
}


~/projects/c++ % clang++ clang_crash.cc
0  clang             0x000000010fd93912 _ZL15PrintStackTracePv + 34
1  clang             0x000000010fd93dd9 _ZL13SignalHandleri + 601
2  libsystem_c.dylib 0x00007fff93657cfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff6ecb6be0 _sigtramp + 18446744073095474944
4  clang             0x000000010f482956 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) + 38
5  clang             0x000000010f477775 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 10645
6  clang             0x000000010f474b8c clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 7612
7  clang             0x000000010f481fd7 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) + 199
8  clang             0x000000010f473864 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 2708
9  clang             0x000000010f472dbd clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 45
10 clang             0x000000010f48c27f
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2015
11 clang             0x000000010f48cea6
clang::Sema::PerformPendingInstantiations(bool) + 150
12 clang             0x000000010f2d211c
clang::Sema::ActOnEndOfTranslationUnit() + 236
13 clang             0x000000010f2bea39
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 105
14 clang             0x000000010f2855dd clang::ParseAST(clang::Sema&, bool) +
317
15 clang             0x000000010f269433 clang::CodeGenAction::ExecuteAction() +
675
16 clang             0x000000010f0e315a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 842
17 clang             0x000000010f0c379a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2554
18 clang             0x000000010f0bc59b cc1_main(char const**, char const**,
char const*, void*) + 5211
19 clang             0x000000010f0bff06 main + 662
20 clang             0x000000010f0bb134 start + 52
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-apple-macosx10.7.2
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
clang_crash.cc -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 123.2.1 -resource-dir
/usr/bin/../lib/clang/2.1 -fdeprecated-macro -ferror-limit 19 -fmessage-length
171 -stack-protector 1 -fblocks -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/7x/z7mjr6y92tv9m6qkv6wb4hdh0000gn/T/cc-HRMAwq.o -x c++
clang_crash.cc 
1.    <eof> parser at end of file
2.    clang_crash.cc:2:6: instantiating function definition 'destroy'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list