Skip to content

Instantly share code, notes, and snippets.

@asterite
Created September 25, 2011 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asterite/1241187 to your computer and use it in GitHub Desktop.
Save asterite/1241187 to your computer and use it in GitHub Desktop.
llvm segfault
%Bar = type { i32 }
%Foo = type { %Bar* }
@.str5 = private constant [4 x i8] c"%d\0A\00", align 1
declare i32 @printf(i8* nocapture, ...) nounwind
define i32 @main() ssp {
entry:
%Bar.i.i.i.i = alloca %Bar, align 8
%Foo.i.i.i = alloca %Foo, align 8
%"@bar.i.i.i" = getelementptr inbounds %Foo* %Foo.i.i.i, i64 0, i32 0
store %Bar* %Bar.i.i.i.i, %Bar** %"@bar.i.i.i", align 8
%"@field.i.i.i.i" = getelementptr inbounds %Bar* %Bar.i.i.i.i, i64 0, i32 0
store i32 20, i32* %"@field.i.i.i.i", align 4
%0 = load %Bar** %"@bar.i.i.i", align 8
%1 = getelementptr inbounds %Foo* %Foo.i.i.i, i64 0, i32 0
%2 = load %Bar** %1, align 8
%3 = getelementptr inbounds %Bar* %2, i64 0, i32 0
%4 = load i32* %3, align 4
%5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str5, i64 0, i64 0), i32 %4) nounwind
ret i32 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment