• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test for a call to __asan_check() preceding stores
2
3; REQUIRES: allow_dump
4
5; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
6; RUN:     | FileCheck --check-prefix=DUMP %s
7
8; A function with a local variable that does the stores
9define internal void @doStores(<4 x i32> %vecSrc, i32 %arg8, i32 %arg16,
10                               i32 %arg32, i32 %arg64, i32 %arg128) {
11  %destLocal8 = inttoptr i32 %arg8 to i8*
12  %destLocal16 = inttoptr i32 %arg16 to i16*
13  %destLocal32 = inttoptr i32 %arg32 to i32*
14  %destLocal64 = inttoptr i32 %arg64 to i64*
15  %destLocal128 = inttoptr i32 %arg128 to <4 x i32>*
16
17  store i8 42, i8* %destLocal8, align 1
18  store i16 42, i16* %destLocal16, align 1
19  store i32 42, i32* %destLocal32, align 1
20  store i64 42, i64* %destLocal64, align 1
21  store <4 x i32> %vecSrc, <4 x i32>* %destLocal128, align 4
22
23  ret void
24}
25
26; DUMP-LABEL: ================ Instrumented CFG ================
27; DUMP-NEXT: define internal void @doStores(
28; DUMP-NEXT: __0:
29; DUMP-NEXT: call void @__asan_check_store(i32 %arg8, i32 1)
30; DUMP-NEXT: store i8 42, i8* %arg8, align 1
31; DUMP-NEXT: call void @__asan_check_store(i32 %arg16, i32 2)
32; DUMP-NEXT: store i16 42, i16* %arg16, align 1
33; DUMP-NEXT: call void @__asan_check_store(i32 %arg32, i32 4)
34; DUMP-NEXT: store i32 42, i32* %arg32, align 1
35; DUMP-NEXT: call void @__asan_check_store(i32 %arg64, i32 8)
36; DUMP-NEXT: store i64 42, i64* %arg64, align 1
37; DUMP-NEXT: call void @__asan_check_store(i32 %arg128, i32 16)
38; DUMP-NEXT: store <4 x i32> %vecSrc, <4 x i32>* %arg128, align 4
39; DUMP:      ret void
40; DUMP-NEXT: }
41