• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that shrinking an allocation updates the redzones
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 %s
8
9
10declare external i32 @malloc(i32)
11declare external i32 @realloc(i32, i32)
12declare external void @free(i32)
13
14define void @_start(i32 %arg) {
15  %ptr16 = call i32 @malloc(i32 16)
16  %off12a = add i32 %ptr16, 12
17  %offptra = inttoptr i32 %off12a to i32*
18  %resa = load i32, i32* %offptra, align 1
19  %ptr8 = call i32 @realloc(i32 %ptr16, i32 8)
20  %off12b = add i32 %ptr8, 12
21  %offptrb = inttoptr i32 %off12b to i8*
22  %resb = load i8, i8* %offptrb, align 1
23  ret void
24}
25
26; CHECK: Illegal 1 byte load from heap object at
27