1 ; ModuleID = 'crash.c' 2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 3 target triple = "x86_64-pc-linux-gnu" 4 5 @.str = private unnamed_addr constant [18 x i8] c"Hello, segfault!\0A\00", align 1 6 @.str1 = private unnamed_addr constant [14 x i8] c"Now crash %d\0A\00", align 1 7 8 ; Function Attrs: nounwind uwtable 9 define i32 @main(i32 %argc, i8** %argv) #0 { 10 %1 = alloca i32, align 4 ;CHECK: !dbg 11 %2 = alloca i32, align 4 ;CHECK-NEXT: !dbg 12 %3 = alloca i8**, align 8 ;CHECK-NEXT: !dbg 13 %null_ptr = alloca i32*, align 8 ;CHECK-NEXT: !dbg 14 store i32 0, i32* %1 ;CHECK-NEXT: !dbg 15 store i32 %argc, i32* %2, align 4 ;CHECK-NEXT: !dbg 16 store i8** %argv, i8*** %3, align 8 ;CHECK-NEXT: !dbg 17 store i32* null, i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg 18 %4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0)) ;CHECK-NEXT: !dbg 19 %5 = load i32** %null_ptr, align 8 ;CHECK-NEXT: !dbg 20 %6 = load i32* %5, align 4 ;CHECK-NEXT: !dbg 21 %7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x i8]* @.str1, i32 0, i32 0), i32 %6) ;CHECK-NEXT: !dbg 22 %8 = load i32* %2, align 4 ;CHECK-NEXT: !dbg 23 ret i32 %8 ;CHECK-NEXT: !dbg 24 } 25 26 declare i32 @printf(i8*, ...) #1 27 28 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } 29 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } 30 31 ; CHECK: = metadata !{i32 14, 32 ; CHECK-NEXT: = metadata !{i32 15, 33 ; CHECK-NEXT: = metadata !{i32 16, 34 ; CHECK-NEXT: = metadata !{i32 17, 35 ; CHECK-NEXT: = metadata !{i32 18, 36 ; CHECK-NEXT: = metadata !{i32 19, 37 ; CHECK-NEXT: = metadata !{i32 20, 38 ; CHECK-NEXT: = metadata !{i32 21, 39 ; CHECK-NEXT: = metadata !{i32 22, 40 ; CHECK-NEXT: = metadata !{i32 23, 41 42 ; RUN: opt %s -debug-ir -S | FileCheck %s 43