[LLVMbugs] [Bug 13401] New: std::shared_ptr in -dealloc cause assertion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 19 02:23:48 PDT 2012


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

             Bug #: 13401
           Summary: std::shared_ptr in -dealloc cause assertion
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: 691D2C6C-B023-46A5-B1D7-ACCBA4713A87 at uuid-mail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This code (using libc++) causes a compiler assertion failure:

Example:

    - (void)dealloc
    {
        std::shared_ptr<int> dummy;
        dummy = std::shared_ptr<int>(); // problematic line
        [super dealloc];
    }

Tested with clang 3.1 and 3.2-r160101 using libc++ r160312.

The code compiles w/o issues using std::tr1::shared_ptr from the GCC 4.2.1
includes (installed via Appleā€™s developer tools on Snow Leopard).

Assertion (source files attached):

Assertion failed: (!ObjCShouldCallSuperDealloc && "This should only be set for
" "ObjC methods, which should have been handled in the block above."), function
ActOnFinishFunctionBody, file SemaDecl.cpp, line 7748.
0  libLLVM-3.2svn.dylib 0x0000000102fc44b2 PrintStackTrace(void*) + 34
1  libLLVM-3.2svn.dylib 0x0000000102fc52c3 SignalHandler(int) + 691
2  libSystem.B.dylib    0x00007fff8921c1ba _sigtramp + 26
3  libSystem.B.dylib    0x00007fff5fbf7d88 _sigtramp + 3600661480
4  libLLVM-3.2svn.dylib 0x000000010210d672 __assert_rtn + 66
5  clang                0x0000000100526373
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 1859
6  clang                0x000000010085f439
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1001
7  clang                0x00000001005f7cf4
clang::Sema::MarkFunctionReferenced(clang::SourceLocation,
clang::FunctionDecl*) + 1444
8  clang                0x0000000100577a34
clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType,
clang::CXXConstructorDecl*, clang::ASTMultiPtr<clang::Expr*>, bool, bool,
unsigned int, clang::SourceRange) + 100
9  clang                0x00000001006c1d0d
PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&,
clang::InitializationKind const&, clang::ASTMultiPtr<clang::Expr*>,
clang::InitializationSequence::Step const&, bool&) + 413
10 clang                0x00000001006d72eb
clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity
const&, clang::InitializationKind const&, clang::ASTMultiPtr<clang::Expr*>,
clang::QualType*) + 6683
11 clang                0x000000010051d9ba
clang::Sema::ActOnUninitializedDecl(clang::Decl*, bool) + 698
12 clang                0x00000001003b6c24
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 964
13 clang                0x00000001003b7aa4
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1220
14 clang                0x00000001003b913c
clang::Parser::ParseSimpleDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 1052
15 clang                0x00000001003b9287
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 231
16 clang                0x00000001004097b6
clang::Parser::ParseStatementOrDeclarationAfterAttributes(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3318
17 clang                0x0000000100409c34
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 148
18 clang                0x000000010040a42a
clang::Parser::ParseCompoundStatementBody(bool) + 1802
19 clang                0x00000001003f8016
clang::Parser::ParseLexedObjCMethodDefs(clang::Parser::LexedMethod&, bool) +
406
20 clang                0x00000001003f8740
clang::Parser::ObjCImplParsingDataRAII::finish(clang::SourceRange) + 128
21 clang                0x00000001003f8cdc
clang::Parser::ParseObjCAtEndDeclaration(clang::SourceRange) + 92
22 clang                0x00000001003fbc7f
clang::Parser::ParseObjCAtDirectives() + 975
23 clang                0x000000010042b113
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1859
24 clang                0x00000001003f9463
clang::Parser::ParseObjCAtImplementationDeclaration(clang::SourceLocation) +
787
25 clang                0x00000001003fbc62
clang::Parser::ParseObjCAtDirectives() + 946
26 clang                0x000000010042b113
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1859
27 clang                0x000000010042ba2c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 364
28 clang                0x0000000100396ba6 clang::ParseAST(clang::Sema&, bool,
bool) + 582
29 clang                0x000000010034003c
clang::CodeGenAction::ExecuteAction() + 60
30 clang                0x0000000100060c26 clang::FrontendAction::Execute() +
70
31 clang                0x00000001000333fd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 413
32 clang                0x000000010000bfdd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1661
33 clang                0x00000001000020b8 cc1_main(char const**, char const**,
char const*, void*) + 1016
34 clang                0x000000010000ad3e main + 4894
35 clang                0x0000000100001448 start + 52
Stack dump:
0.    Program arguments: /opt/local/libexec/llvm-3.2/bin/clang -cc1 -triple
x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free -main-file-name
clang_bug.mm -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -target-linker-version 127.2 -resource-dir
/opt/local/libexec/llvm-3.2/bin/../lib/clang/3.2 -I /usr/include/c++/v1
-fmodule-cache-path
/var/folders/X5/X5CC4WkHHGOn9kdy14YNDE+++TI/-Tmp-/clang-module-cache
-stdlib=libc++ -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir
/Users/duff/Shared -ferror-limit 19 -fmessage-length 200 -stack-protector 1
-mstackrealign -fblocks -fobjc-runtime=macosx-10.6.0
-fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties
-fobjc-exceptions -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o
/var/folders/X5/X5CC4WkHHGOn9kdy14YNDE+++TI/-Tmp-/clang_bug-1XkOSj.o -x
objective-c++ clang_bug.mm 
1.    clang_bug.mm:13:28: current parser token ';'
2.    clang_bug.mm:12:1: in compound statement ('{}')
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 160101)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

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