OLD | NEW |
1 ; Test that potentially widened loads to not trigger an error report | 1 ; Test that potentially widened loads to not trigger an error report |
2 | 2 |
3 ; REQUIRES: no_minimal_build | 3 ; REQUIRES: no_minimal_build |
4 | 4 |
5 ; check for wide load exception | 5 ; check for wide load exception |
6 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 6 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
7 ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \ | 7 ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \ |
8 ; RUN: %t.pexe -o %t && %t | FileCheck %s --check-prefix=WIDE --allow-empty | 8 ; RUN: %t.pexe -o %t && %t | FileCheck %s --check-prefix=WIDE --allow-empty |
9 | 9 |
10 ; check for error reporting | 10 ; check for error reporting |
(...skipping 15 matching lines...) Expand all Loading... |
26 define internal void @no_wide_load() { | 26 define internal void @no_wide_load() { |
27 %str = alloca i8, i32 1, align 1 | 27 %str = alloca i8, i32 1, align 1 |
28 %straddr = ptrtoint i8* %str to i32 | 28 %straddr = ptrtoint i8* %str to i32 |
29 %off1addr = add i32 %straddr, 1 | 29 %off1addr = add i32 %straddr, 1 |
30 %off1 = inttoptr i32 %off1addr to i8* | 30 %off1 = inttoptr i32 %off1addr to i8* |
31 %contents = load i8, i8* %off1, align 1 | 31 %contents = load i8, i8* %off1, align 1 |
32 call void @exit(i32 1) | 32 call void @exit(i32 1) |
33 unreachable | 33 unreachable |
34 } | 34 } |
35 | 35 |
36 ; WIDE-NOT: Illegal access | 36 ; WIDE-NOT: Illegal |
37 ; NOWIDE: Illegal access of 1 bytes at | 37 ; NOWIDE: Illegal 1 byte load from stack object at |
38 | 38 |
39 ; use argc to determine which test routine to run | 39 ; use argc to determine which test routine to run |
40 define void @_start(i32 %arg) { | 40 define void @_start(i32 %arg) { |
41 %argcaddr = add i32 %arg, 8 | 41 %argcaddr = add i32 %arg, 8 |
42 %argcptr = inttoptr i32 %argcaddr to i32* | 42 %argcptr = inttoptr i32 %argcaddr to i32* |
43 %argc = load i32, i32* %argcptr, align 1 | 43 %argc = load i32, i32* %argcptr, align 1 |
44 switch i32 %argc, label %error [i32 1, label %wide_load | 44 switch i32 %argc, label %error [i32 1, label %wide_load |
45 i32 2, label %no_wide_load] | 45 i32 2, label %no_wide_load] |
46 wide_load: | 46 wide_load: |
47 call void @wide_load() | 47 call void @wide_load() |
48 br label %error | 48 br label %error |
49 no_wide_load: | 49 no_wide_load: |
50 call void @no_wide_load() | 50 call void @no_wide_load() |
51 br label %error | 51 br label %error |
52 error: | 52 error: |
53 call void @exit(i32 1) | 53 call void @exit(i32 1) |
54 unreachable | 54 unreachable |
55 } | 55 } |
OLD | NEW |