OLD | NEW |
1 ; Test that shrinking an allocation updates the redzones | 1 ; Test that shrinking an allocation updates the redzones |
2 | 2 |
3 ; REQUIRES: no_minimal_build | 3 ; REQUIRES: no_minimal_build |
4 | 4 |
5 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 5 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
6 ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \ | 6 ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \ |
7 ; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s | 7 ; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s |
8 | 8 |
9 | 9 |
10 declare external i32 @malloc(i32) | 10 declare external i32 @malloc(i32) |
11 declare external i32 @realloc(i32, i32) | 11 declare external i32 @realloc(i32, i32) |
12 declare external void @free(i32) | 12 declare external void @free(i32) |
13 | 13 |
14 define void @_start(i32 %arg) { | 14 define void @_start(i32 %arg) { |
15 %ptr16 = call i32 @malloc(i32 16) | 15 %ptr16 = call i32 @malloc(i32 16) |
16 %off12a = add i32 %ptr16, 12 | 16 %off12a = add i32 %ptr16, 12 |
17 %offptra = inttoptr i32 %off12a to i32* | 17 %offptra = inttoptr i32 %off12a to i32* |
18 %resa = load i32, i32* %offptra, align 1 | 18 %resa = load i32, i32* %offptra, align 1 |
19 %ptr8 = call i32 @realloc(i32 %ptr16, i32 8) | 19 %ptr8 = call i32 @realloc(i32 %ptr16, i32 8) |
20 %off12b = add i32 %ptr8, 12 | 20 %off12b = add i32 %ptr8, 12 |
21 %offptrb = inttoptr i32 %off12b to i8* | 21 %offptrb = inttoptr i32 %off12b to i8* |
22 %resb = load i8, i8* %offptrb, align 1 | 22 %resb = load i8, i8* %offptrb, align 1 |
23 ret void | 23 ret void |
24 } | 24 } |
25 | 25 |
26 ; CHECK: Illegal access of 1 bytes at | 26 ; CHECK: Illegal 1 byte load from heap object at |
OLD | NEW |