• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that double frees are detected
2
3; REQUIRES: no_minimal_build
4
5; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
6; RUN:     --fsanitize-address --sz=-allow-externally-defined-symbols \
7; RUN:     %t.pexe -o %t && %t 2>&1 | FileCheck --check-prefix=ERR %s
8; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
9; RUN:     --fsanitize-address --sz=-allow-externally-defined-symbols -O2 \
10; RUN:     %t.pexe -o %t && %t 2>&1 | FileCheck --check-prefix=ERR %s
11
12declare external i32 @malloc(i32)
13declare external void @free(i32)
14declare external void @exit(i32)
15
16define void @_start(i32 %arg) {
17  %alloc = call i32 @malloc(i32 42)
18  call void @free(i32 %alloc)
19  call void @free(i32 %alloc)
20  call void @exit(i32 1)
21  ret void
22}
23
24; ERR: Double free of object at
25; ERR-NEXT: address of __asan_error symbol is
26