Home | History | Annotate | Download | only in asan_tests
      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 
     12 declare external i32 @malloc(i32)
     13 declare external void @free(i32)
     14 declare external void @exit(i32)
     15 
     16 define 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