[LLVMbugs] [Bug 10411] New: assertion when using exception and ARC

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 19 11:57:28 PDT 2011


           Summary: assertion when using exception and ARC
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: devlists at shadowlab.org
                CC: llvmbugs at cs.uiuc.edu

Clang (trunk 135497) failed to compile code that throw exception when ARC is
It reaches an assertion in ActOnFinishFunctionBody().

For instance the following code failed to compile:

------- test.m
@interface NSException
+ (id)exception;

void test() { @throw [NSException exception]; }

% clang -fobjc-arc -c test.m
Assertion failed: (!ExprNeedsCleanups && "Unaccounted cleanups in function"),
function ActOnFinishFunctionBody, file SemaDecl.cpp, line 6536.
0  clang             0x000000010ec97842 _ZL15PrintStackTracePv + 34
5  clang             0x000000010ec97a45 __assert_rtn + 53
6  clang             0x000000010df12d23
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 1347
7  clang             0x000000010de570c4
clang::Parser::ParseScope&) + 244
8  clang             0x000000010de6212d
clang::Parser::ParsedTemplateInfo const&) + 1885
9  clang             0x000000010de267ab
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 907
18 clang             0x000000010dbff68a cc1_main(char const**, char const**,
char const*, void*) + 5450
19 clang             0x000000010dc033d2 main + 706
20 clang             0x000000010dbfe134 start + 52
21 clang             0x000000000000002b start + 18446744069183905579
Stack dump:
0.    Program arguments:
/Users/jddupas/Projects/OpenSource/llvm/release/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-main-file-name test.m -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 123.2.1 -coverage-file
test.o -resource-dir
-ferror-limit 19 -fmessage-length 170 -stack-protector 1 -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-nonfragile-abi
-fobjc-dispatch-method=mixed -fobjc-arc -fobjc-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o test.o -x objective-c test.m 
1.    <eof> parser at end of file
2.    test.m:5:13: parsing function body 'test'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal 2 (use -v to see

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