clang crashes when building code refactored to ARC
clang crashes when building code refactored to ARC
- Subject: clang crashes when building code refactored to ARC
- From: Eeyore <email@hidden>
- Date: Tue, 18 Oct 2011 10:06:54 -0700
Before reporting this as a clang bug, would like to see if I'm doing anything wrong in my code. Original code is below. When I choose "Edit>Refactor>Convert to Obj-C ARC..." the migration appears to happen without any issues and (as expected) removes the autorelease calls from the code (and changes nothing else). However, when I try to build the resulting code, I receive the error below. Commenting out the non-default case removes the error, so my guess is that clang can't figure out where to retain/release the table cells. This happens every place I have a similarly designed tableView:cellForRowAtIndexPath: method.
Using Xcode 4.2 Build 4D199, installed on Lion 10.7.2.
Thanks,
Aaron
---------- begin original code
- (UITableViewCell*)tableView: (UITableView*)inTableView cellForRowAtIndexPath: (NSIndexPath*)inIndexPath
{
NSParameterAssert(inTableView == self.raceTable);
UITableViewCell* theCell = nil;
switch(inIndexPath.section)
{
case MWViewMeetSection_Insert:
{
MWTableCellWithAdd* theAddCell = (MWTableCellWithAdd*) [inTableView dequeueReusableCellWithIdentifier: MWTableCellWithAdd_Identifier];
if (theAddCell == nil)
{
theAddCell = [[[MWTableCellWithAdd alloc] init] autorelease];
}
else
{
[theAddCell prepareForReuse];
}
theAddCell.name = [MWRace singularTypename];
theCell = theAddCell;
break;
}
default:
{
theCell = [[[UITableViewCell alloc] init] autorelease];
break;
}
}
return theCell;
}
---------- end original code
---------- begin error
CompileC /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.o Source/MeetViewControllers/MWViewMeetController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/eeyore/Developer/iSplit
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=c99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Werror -Werror-implicit-function-declaration -Wmissing-field-initializers -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wsign-compare -Wshorten-64-to-32 -Wnewline-eof -Wstrict-selector-match -Wundeclared-selector -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fexceptions -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -I/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/iSplit.hmap -I/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Products/Development-iphonesimulator/include -I/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/DerivedSources/i386 -I/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/DerivedSources -Wall -F/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Products/Development-iphonesimulator -include /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/PrecompiledHeaders/prefix-fcnvzovjwysiynecktskphtmwdzc/prefix.pch -MMD -MT dependencies -MF /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.d -c /Users/eeyore/Developer/iSplit/Source/MeetViewControllers/MWViewMeetController.m -o /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.o
0 clang 0x000000010b3a5312 _ZL15PrintStackTracePv + 34
1 clang 0x000000010b3a57e9 _ZL13SignalHandleri + 633
2 libsystem_c.dylib 0x00007fff8f998cfa _sigtramp + 26
3 clang 0x000000010a762e40 _ZL9RetCC_X86jN4llvm3MVTES0_NS_11CCValAssign7LocInfoENS_3ISD10ArgFlagsTyERNS_7CCStateE + 1008
4 clang 0x000000010b1c6103 llvm::SelectionDAG::getLoad(llvm::ISD::MemIndexedMode, llvm::ISD::LoadExtType, llvm::EVT, llvm::DebugLoc, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::MachinePointerInfo, llvm::EVT, bool, bool, unsigned int, llvm::MDNode const*) + 115
5 clang 0x000000010a89d4dc llvm::SelectionDAG::getLoad(llvm::EVT, llvm::DebugLoc, llvm::SDValue, llvm::SDValue, llvm::MachinePointerInfo, bool, bool, unsigned int, llvm::MDNode const*) + 252
6 clang 0x000000010a89cb8b llvm::SelectionDAGBuilder::visitLoad(llvm::LoadInst const&) + 1547
7 clang 0x000000010a7ccbf5 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) + 517
8 clang 0x000000010a7cc1d2 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 66
9 clang 0x000000010a7cc108 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 40
10 clang 0x000000010a70a6ff llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 2927
11 clang 0x000000010a706300 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 832
12 clang 0x000000010a705fae llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
13 clang 0x000000010a6f6855 llvm::FPPassManager::runOnFunction(llvm::Function&) + 325
14 clang 0x000000010a6fb39b llvm::FPPassManager::runOnModule(llvm::Module&) + 139
15 clang 0x000000010a6f6fd4 llvm::MPPassManager::runOnModule(llvm::Module&) + 276
16 clang 0x000000010a6f6b58 llvm::PassManagerImpl::run(llvm::Module&) + 280
17 clang 0x000000010a6f6a3d llvm::PassManager::run(llvm::Module&) + 13
18 clang 0x000000010abc593d clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions const&, clang::TargetOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 4381
19 clang 0x000000010a6de3f6 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 246
20 clang 0x000000010a606276 clang::ParseAST(clang::Sema&, bool) + 422
21 clang 0x000000010a604caf clang::CodeGenAction::ExecuteAction() + 671
22 clang 0x000000010a5f0a9b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 875
23 clang 0x000000010a5eeb18 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2696
24 clang 0x000000010a5e3315 cc1_main(char const**, char const**, char const*, void*) + 5333
25 clang 0x000000010a5c647b main + 667
26 clang 0x000000010a5c61d4 start + 52
27 clang 0x0000000000000061 start + 18446744069240757953
Stack dump:
0. Program arguments: /Developer/usr/bin/clang -cc1 -triple i386-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name MWViewMeetController.m -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -target-cpu yonah -target-linker-version 127.2 -g -coverage-file /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.o -resource-dir /Developer/usr/bin/../lib/clang/3.0 -dependency-file /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.d -MT dependencies -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -include-pch /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/PrecompiledHeaders/prefix-fcnvzovjwysiynecktskphtmwdzc/prefix.pch.pth -D IBOutlet=__attribute__((iboutlet)) -D IBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName))) -D IBAction=void)__attribute__((ibaction) -D __IPHONE_OS_VERSION_MIN_REQUIRED=40000 -I /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/iSplit.hmap -I /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Products/Development-iphonesimulator/include -I /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/DerivedSources/i386 -I /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/DerivedSources -F/Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Products/Development-iphonesimulator -O0 -Wno-trigraphs -Werror -Werror-implicit-function-declaration -Wmissing-field-initializers -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wsign-compare -Wshorten-64-to-32 -Wnewline-eof -Wstrict-selector-match -Wundeclared-selector -Wno-sign-conversion -Wall -std=c99 -ferror-limit 19 -fmessage-length 0 -fdiagnostics-print-source-range-info -fdiagnostics-parseable-fixits -stack-protector 1 -fblocks -fobjc-nonfragile-abi -fobjc-arc -fobjc-exceptions -fexceptions -fpascal-strings -fdiagnostics-show-option -fdiagnostics-show-category id -o /Users/eeyore/Library/Developer/Xcode/DerivedData/Shared/Intermediates/iSplit.build/Development-iphonesimulator/iSplit.build/Objects-normal/i386/MWViewMeetController.o -x objective-c /Users/eeyore/Developer/iSplit/Source/MeetViewControllers/MWViewMeetController.m
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/Users/eeyore/Developer/iSplit/Source/MeetViewControllers/MWViewMeetController.m'.
4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@"\01-[MWViewMeetController tableView:cellForRowAtIndexPath:]"'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 254
---------- end error
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden