Skip to content

Instantly share code, notes, and snippets.

@tru
Created February 7, 2012 21:32
Show Gist options
  • Save tru/1762139 to your computer and use it in GitHub Desktop.
Save tru/1762139 to your computer and use it in GitHub Desktop.
22:30 firefly:~/clang-bug $ make
clang -c -o clangbug.o clangbug.m
clang -c -fobjc-arc -o main.o main.m
0 clang 0x0000000106bdd312 _ZL15PrintStackTracePv + 34
1 clang 0x0000000106bdd7e9 _ZL13SignalHandleri + 633
2 libsystem_c.dylib 0x00007fff8c190cfa _sigtramp + 26
3 libsystem_c.dylib 0x0000000000000010 _sigtramp + 18446603338165711664
4 clang 0x00000001064464e0 clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(clang::BinaryOperator const*, bool) + 448
5 clang 0x00000001064394b4 clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) + 3220
6 clang 0x0000000105f122f8 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 72
7 clang 0x00000001060a81e9 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) + 57
8 clang 0x00000001060aa989 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 41
9 clang 0x0000000105f11922 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 194
10 clang 0x000000010644675b clang::CodeGen::CodeGenFunction::EmitObjCAutoreleasePoolStmt(clang::ObjCAutoreleasePoolStmt const&) + 267
11 clang 0x0000000105f11a02 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 418
12 clang 0x0000000105f11edb clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 267
13 clang 0x0000000105f11c98 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 152
14 clang 0x0000000105f11880 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 32
15 clang 0x00000001064810af clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 719
16 clang 0x00000001064841e9 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl) + 1897
17 clang 0x0000000106482b59 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 393
18 clang 0x000000010648354d clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 605
19 clang 0x0000000105e6a28c clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 204
20 clang 0x0000000105e6a19f (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 95
21 clang 0x0000000105e6a111 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 161
22 clang 0x0000000105e3e1f2 clang::ParseAST(clang::Sema&, bool) + 290
23 clang 0x0000000105e3ccaf clang::CodeGenAction::ExecuteAction() + 671
24 clang 0x0000000105e28a9b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 875
25 clang 0x0000000105e26b18 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2696
26 clang 0x0000000105e1b315 cc1_main(char const**, char const**, char const*, void*) + 5333
27 clang 0x0000000105dfe47b main + 667
28 clang 0x0000000105dfe1d4 start + 52
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-apple-macosx10.7.3 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.m -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 127.2 -coverage-file main.o -resource-dir /usr/bin/../lib/clang/3.0 -ferror-limit 19 -fmessage-length 131 -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 main.o -x objective-c main.m
1. <eof> parser at end of file
2. main.m:4:5: LLVM IR generation of declaration 'main'
3. main.m:4:5: Generating code for declaration 'main'
4. main.m:5:1: LLVM IR generation of compound statement ('{}')
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
make: *** [main.o] Error 254
=== clangbug.m
#import "clangbug.h"
@implementation ClangBug
-(void)setFoobar:(id)fo
{
foobar = fo;
}
@end
==== clangbug.h
#import <Foundation/Foundation.h>
@interface ClangBug:NSObject
{
id foobar;
}
-(void)setFoobar:(id)fo;
@end
==== main.m
#import <Foundation/Foundation.h>
#import "clangbug.h"
int main(int argc, char **argv)
{
@autoreleasepool {
ClangBug *cb = [ClangBug new];
cb.foobar = @"korv";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment