LEFT | RIGHT |
1 ; Valid access to a very large global array. | 1 ; Valid access to a very large global array. |
2 | 2 |
3 ; RUN: opt < %s -asan -S -asan-opt=1 | FileCheck %s -check-prefix=OPT1 | 3 ; RUN: opt < %s -asan -S -asan-opt=1 -asan-opt-known-bounds=1 | FileCheck %s -ch
eck-prefix=OPT1 |
4 ; RUN: opt < %s -asan -S -asan-opt=0 | FileCheck %s -check-prefix=OPT0 | 4 ; RUN: opt < %s -asan -S -asan-opt=0 | FileCheck %s -check-prefix=OPT0 |
5 | 5 |
6 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
2:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" | 6 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
2:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" |
7 target triple = "i386-unknown-linux-gnu" | 7 target triple = "i386-unknown-linux-gnu" |
8 | 8 |
9 @array = internal global [2147483649 x i8] zeroinitializer, align 1 | 9 @array = internal global [2147483649 x i8] zeroinitializer, align 1 |
10 | 10 |
11 define signext i8 @example() address_safety nounwind { | 11 define signext i8 @example() address_safety nounwind { |
12 entry: | 12 entry: |
13 %0 = load volatile i8* getelementptr inbounds ([2147483649 x i8]* @array, i32
0, i32 -2147483648), align 1 | 13 %0 = load volatile i8* getelementptr inbounds ([2147483649 x i8]* @array, i32
0, i32 -2147483648), align 1 |
14 ret i8 %0 | 14 ret i8 %0 |
15 } | 15 } |
16 | 16 |
17 ; OPT1: @example | 17 ; OPT1: @example |
18 ; OPT1-NOT: call void @__asan_report_ | 18 ; OPT1-NOT: call void @__asan_report_ |
19 ; OPT1: @asan.module_ctor | 19 ; OPT1: @asan.module_ctor |
20 | 20 |
21 ; OPT0: @example | 21 ; OPT0: @example |
22 ; OPT0: call void @__asan_report_ | 22 ; OPT0: call void @__asan_report_ |
23 ; OPT0-NOT: call void @__asan_report_ | 23 ; OPT0-NOT: call void @__asan_report_ |
24 ; OPT0: @asan.module_ctor | 24 ; OPT0: @asan.module_ctor |
25 | 25 |
26 ; C-example: volatile static char array[(1u << 31) + 1]; | 26 ; C-example: volatile static char array[(1u << 31) + 1]; |
27 ; C-example: | 27 ; C-example: |
28 ; C-example: char example(void) { | 28 ; C-example: char example(void) { |
29 ; C-example: return array[(1u << 31)]; | 29 ; C-example: return array[(1u << 31)]; |
30 ; C-example: } | 30 ; C-example: } |
LEFT | RIGHT |