Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions test_cases_bc/mem_leak/leak_win_heap.c.bc
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
; ModuleID = 'src/mem_leak/leak_win_heap.c'
source_filename = "src/mem_leak/leak_win_heap.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @SAFEMALLOC(i32 noundef %n) #0 !dbg !13 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !20, metadata !DIExpression()), !dbg !21
%0 = load i32, ptr %n.addr, align 4, !dbg !22
%conv = sext i32 %0 to i64, !dbg !22
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !23
ret ptr %call, !dbg !24
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @PLKMALLOC(i32 noundef %n) #0 !dbg !25 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !26, metadata !DIExpression()), !dbg !27
%0 = load i32, ptr %n.addr, align 4, !dbg !28
%conv = sext i32 %0 to i64, !dbg !28
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !29
ret ptr %call, !dbg !30
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @NFRMALLOC(i32 noundef %n) #0 !dbg !31 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !32, metadata !DIExpression()), !dbg !33
%0 = load i32, ptr %n.addr, align 4, !dbg !34
%conv = sext i32 %0 to i64, !dbg !34
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !35
ret ptr %call, !dbg !36
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @CLKMALLOC(i32 noundef %n) #0 !dbg !37 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !38, metadata !DIExpression()), !dbg !39
%0 = load i32, ptr %n.addr, align 4, !dbg !40
%conv = sext i32 %0 to i64, !dbg !40
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !41
ret ptr %call, !dbg !42
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @NFRLEAKFP(i32 noundef %n) #0 !dbg !43 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !44, metadata !DIExpression()), !dbg !45
%0 = load i32, ptr %n.addr, align 4, !dbg !46
%conv = sext i32 %0 to i64, !dbg !46
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !47
ret ptr %call, !dbg !48
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @PLKLEAKFP(i32 noundef %n) #0 !dbg !49 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !50, metadata !DIExpression()), !dbg !51
%0 = load i32, ptr %n.addr, align 4, !dbg !52
%conv = sext i32 %0 to i64, !dbg !52
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !53
ret ptr %call, !dbg !54
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local ptr @LEAKFN(i32 noundef %n) #0 !dbg !55 {
entry:
%n.addr = alloca i32, align 4
store i32 %n, ptr %n.addr, align 4
call void @llvm.dbg.declare(metadata ptr %n.addr, metadata !56, metadata !DIExpression()), !dbg !57
%0 = load i32, ptr %n.addr, align 4, !dbg !58
%conv = sext i32 %0 to i64, !dbg !58
%call = call noalias ptr @malloc(i64 noundef %conv) #4, !dbg !59
ret ptr %call, !dbg !60
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 !dbg !61 {
entry:
%retval = alloca i32, align 4
%p1 = alloca ptr, align 8
%p2 = alloca ptr, align 8
%p3 = alloca ptr, align 8
store i32 0, ptr %retval, align 4
call void @llvm.dbg.declare(metadata ptr %p1, metadata !64, metadata !DIExpression()), !dbg !65
%call = call ptr @GetProcessHeap(), !dbg !66
%call1 = call ptr @HeapAlloc(ptr noundef %call, i32 noundef 0, i64 noundef 100), !dbg !67
store ptr %call1, ptr %p1, align 8, !dbg !65
call void @llvm.dbg.declare(metadata ptr %p2, metadata !68, metadata !DIExpression()), !dbg !69
%call2 = call ptr @LocalAlloc(i32 noundef 0, i64 noundef 100), !dbg !70
store ptr %call2, ptr %p2, align 8, !dbg !69
call void @llvm.dbg.declare(metadata ptr %p3, metadata !71, metadata !DIExpression()), !dbg !72
%call3 = call ptr @GetProcessHeap(), !dbg !73
%call4 = call ptr @HeapAlloc(ptr noundef %call3, i32 noundef 0, i64 noundef 100), !dbg !74
store ptr %call4, ptr %p3, align 8, !dbg !72
%call5 = call ptr @GetProcessHeap(), !dbg !75
%0 = load ptr, ptr %p3, align 8, !dbg !76
%call6 = call i32 @HeapFree(ptr noundef %call5, i32 noundef 0, ptr noundef %0), !dbg !77
ret i32 0, !dbg !78
}

declare ptr @HeapAlloc(ptr noundef, i32 noundef, i64 noundef) #3

declare ptr @GetProcessHeap() #3

declare ptr @LocalAlloc(i32 noundef, i64 noundef) #3

declare i32 @HeapFree(ptr noundef, i32 noundef, ptr noundef) #3

attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind allocsize(0) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(0) }

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7, !8, !9, !10, !11}
!llvm.ident = !{!12}

!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "Ubuntu clang version 18.1.3 (1ubuntu1)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "src/mem_leak/leak_win_heap.c", directory: "/home/runner/work/Test-Suite/Test-Suite", checksumkind: CSK_MD5, checksum: "aed82c35c27d4b22d3485251151611ae")
!2 = !{!3}
!3 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64)
!4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!5 = !{i32 7, !"Dwarf Version", i32 5}
!6 = !{i32 2, !"Debug Info Version", i32 3}
!7 = !{i32 1, !"wchar_size", i32 4}
!8 = !{i32 8, !"PIC Level", i32 2}
!9 = !{i32 7, !"PIE Level", i32 2}
!10 = !{i32 7, !"uwtable", i32 2}
!11 = !{i32 7, !"frame-pointer", i32 2}
!12 = !{!"Ubuntu clang version 18.1.3 (1ubuntu1)"}
!13 = distinct !DISubprogram(name: "SAFEMALLOC", scope: !14, file: !14, line: 5, type: !15, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!14 = !DIFile(filename: "memleak_check.h", directory: "/home/runner/work/Test-Suite/Test-Suite", checksumkind: CSK_MD5, checksum: "f78006bd129ed179fe44821c3aed9305")
!15 = !DISubroutineType(types: !16)
!16 = !{!17, !18}
!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
!18 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!19 = !{}
!20 = !DILocalVariable(name: "n", arg: 1, scope: !13, file: !14, line: 5, type: !18)
!21 = !DILocation(line: 5, column: 22, scope: !13)
!22 = !DILocation(line: 6, column: 17, scope: !13)
!23 = !DILocation(line: 6, column: 10, scope: !13)
!24 = !DILocation(line: 6, column: 3, scope: !13)
!25 = distinct !DISubprogram(name: "PLKMALLOC", scope: !14, file: !14, line: 9, type: !15, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!26 = !DILocalVariable(name: "n", arg: 1, scope: !25, file: !14, line: 9, type: !18)
!27 = !DILocation(line: 9, column: 21, scope: !25)
!28 = !DILocation(line: 10, column: 17, scope: !25)
!29 = !DILocation(line: 10, column: 10, scope: !25)
!30 = !DILocation(line: 10, column: 3, scope: !25)
!31 = distinct !DISubprogram(name: "NFRMALLOC", scope: !14, file: !14, line: 13, type: !15, scopeLine: 13, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!32 = !DILocalVariable(name: "n", arg: 1, scope: !31, file: !14, line: 13, type: !18)
!33 = !DILocation(line: 13, column: 21, scope: !31)
!34 = !DILocation(line: 14, column: 17, scope: !31)
!35 = !DILocation(line: 14, column: 10, scope: !31)
!36 = !DILocation(line: 14, column: 3, scope: !31)
!37 = distinct !DISubprogram(name: "CLKMALLOC", scope: !14, file: !14, line: 17, type: !15, scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!38 = !DILocalVariable(name: "n", arg: 1, scope: !37, file: !14, line: 17, type: !18)
!39 = !DILocation(line: 17, column: 21, scope: !37)
!40 = !DILocation(line: 18, column: 17, scope: !37)
!41 = !DILocation(line: 18, column: 10, scope: !37)
!42 = !DILocation(line: 18, column: 3, scope: !37)
!43 = distinct !DISubprogram(name: "NFRLEAKFP", scope: !14, file: !14, line: 21, type: !15, scopeLine: 21, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!44 = !DILocalVariable(name: "n", arg: 1, scope: !43, file: !14, line: 21, type: !18)
!45 = !DILocation(line: 21, column: 21, scope: !43)
!46 = !DILocation(line: 22, column: 17, scope: !43)
!47 = !DILocation(line: 22, column: 10, scope: !43)
!48 = !DILocation(line: 22, column: 3, scope: !43)
!49 = distinct !DISubprogram(name: "PLKLEAKFP", scope: !14, file: !14, line: 25, type: !15, scopeLine: 25, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!50 = !DILocalVariable(name: "n", arg: 1, scope: !49, file: !14, line: 25, type: !18)
!51 = !DILocation(line: 25, column: 21, scope: !49)
!52 = !DILocation(line: 26, column: 17, scope: !49)
!53 = !DILocation(line: 26, column: 10, scope: !49)
!54 = !DILocation(line: 26, column: 3, scope: !49)
!55 = distinct !DISubprogram(name: "LEAKFN", scope: !14, file: !14, line: 29, type: !15, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!56 = !DILocalVariable(name: "n", arg: 1, scope: !55, file: !14, line: 29, type: !18)
!57 = !DILocation(line: 29, column: 18, scope: !55)
!58 = !DILocation(line: 30, column: 17, scope: !55)
!59 = !DILocation(line: 30, column: 10, scope: !55)
!60 = !DILocation(line: 30, column: 3, scope: !55)
!61 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 11, type: !62, scopeLine: 11, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !19)
!62 = !DISubroutineType(types: !63)
!63 = !{!18}
!64 = !DILocalVariable(name: "p1", scope: !61, file: !1, line: 13, type: !3)
!65 = !DILocation(line: 13, column: 11, scope: !61)
!66 = !DILocation(line: 13, column: 33, scope: !61)
!67 = !DILocation(line: 13, column: 23, scope: !61)
!68 = !DILocalVariable(name: "p2", scope: !61, file: !1, line: 16, type: !3)
!69 = !DILocation(line: 16, column: 11, scope: !61)
!70 = !DILocation(line: 16, column: 23, scope: !61)
!71 = !DILocalVariable(name: "p3", scope: !61, file: !1, line: 19, type: !3)
!72 = !DILocation(line: 19, column: 11, scope: !61)
!73 = !DILocation(line: 19, column: 33, scope: !61)
!74 = !DILocation(line: 19, column: 23, scope: !61)
!75 = !DILocation(line: 20, column: 14, scope: !61)
!76 = !DILocation(line: 20, column: 35, scope: !61)
!77 = !DILocation(line: 20, column: 5, scope: !61)
!78 = !DILocation(line: 22, column: 5, scope: !61)
Loading