[LLVMbugs] [Bug 17162] New: Crash with warnings when deleting incomplete type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 8 21:52:40 PDT 2013


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

            Bug ID: 17162
           Summary: Crash with warnings when deleting incomplete type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Matthew.Arsenault at amd.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11167
  --> http://llvm.org/bugs/attachment.cgi?id=11167&action=edit
Testcase

This testcase when compiled with -Wall crashes when deleting a pointer with
incomplete type. This only occurs when using the warnings.

This is using r190291

$ /usr/local/bin/clang++ -Wall crash_on_delete_incomplete.cpp -c -o /dev/null 
crash_on_delete_incomplete.cpp:16:5: warning: deleting pointer to incomplete
type 'Foo' may cause undefined behavior
      [-Wdelete-incomplete]
    delete m_foo;
    ^      ~~~~~
crash_on_delete_incomplete.cpp:3:7: note: forward declaration of 'Foo'
class Foo;
      ^
0  clang-3.4       0x00000000010b1ec5 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang-3.4       0x00000000010b2323
2  libpthread.so.0 0x00007fb1d4fef870
3  clang-3.4       0x0000000001a6dbd3
4  clang-3.4       0x0000000001a6ee07
5  clang-3.4       0x0000000001a6acfc
6  clang-3.4       0x0000000001a6590d clang::CFG::buildCFG(clang::Decl const*,
clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&) + 1837
7  clang-3.4       0x0000000001a60c12 clang::AnalysisDeclContext::getCFG() + 98
8  clang-3.4       0x0000000001637177
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr const*) +
4663
9  clang-3.4       0x000000000139f66f
clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy
const*, clang::Decl const*, clang::BlockExpr const*) + 287
10 clang-3.4       0x000000000142cfbe
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 2654
11 clang-3.4       0x000000000138127e
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 270
12 clang-3.4       0x0000000001322f9b
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1755
13 clang-3.4       0x0000000001331596
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1302
14 clang-3.4       0x00000000013227cb
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 587
15 clang-3.4       0x0000000001322380
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 368
16 clang-3.4       0x0000000001321acd
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2269
17 clang-3.4       0x0000000001321170
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 304
18 clang-3.4       0x000000000131e516 clang::ParseAST(clang::Sema&, bool, bool)
+ 454
19 clang-3.4       0x00000000010c9dd9 clang::CodeGenAction::ExecuteAction() +
73
20 clang-3.4       0x0000000001280357 clang::FrontendAction::Execute() + 87
21 clang-3.4       0x00000000012613dd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 797
22 clang-3.4       0x00000000010b572d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3149
23 clang-3.4       0x00000000006483fd cc1_main(char const**, char const**, char
const*, void*) + 669
24 clang-3.4       0x0000000000646dbc main + 8876
25 libc.so.6       0x00007fb1d4224bc5 __libc_start_main + 245
26 clang-3.4       0x0000000000644a09
Stack dump:
0.    Program arguments: /usr/local/bin/clang-3.4 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name crash_on_delete_incomplete.cpp
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-coverage-file /dev/null -resource-dir /usr/local/bin/../lib/clang/3.4
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/x86_64-unknown-linux-gnu/c++/4.8.1
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.4/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wall -fdeprecated-macro
-fdebug-compilation-dir /home/matt/cods_clang_crash -ferror-limit 19
-fmessage-length 130 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /dev/null -x
c++ crash_on_delete_incomplete.cpp 
1.    <eof> parser at end of file
2.    crash_on_delete_incomplete.cpp:15:1: parsing function body '~Bar'
clang-3.4: error: unable to execute command: Segmentation fault (core dumped)

-- 
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/20130909/e3344dd6/attachment.html>


More information about the llvm-bugs mailing list