1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -passes=hwasan -S | FileCheck %s
3 ; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=ABORT-ZERO-BASED-SHADOW
5 ; This shows that HWASan omits the memaccess check when dereferencing a null
7 ; The output is used as the source for llvm/test/CodeGen/AArch64/hwasan-zero-ptr.ll.
9 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
10 target triple = "aarch64--linux-android10000"
12 define void @test_store_to_zeroptr() sanitize_hwaddress {
13 ; CHECK-LABEL: define void @test_store_to_zeroptr
14 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
16 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
17 ; CHECK-NEXT: [[B:%.*]] = inttoptr i64 0 to ptr
18 ; CHECK-NEXT: store i64 42, ptr [[B]], align 8
19 ; CHECK-NEXT: ret void
21 ; ABORT-ZERO-BASED-SHADOW-LABEL: define void @test_store_to_zeroptr
22 ; ABORT-ZERO-BASED-SHADOW-SAME: () #[[ATTR0:[0-9]+]] {
23 ; ABORT-ZERO-BASED-SHADOW-NEXT: entry:
24 ; ABORT-ZERO-BASED-SHADOW-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
25 ; ABORT-ZERO-BASED-SHADOW-NEXT: [[B:%.*]] = inttoptr i64 0 to ptr
26 ; ABORT-ZERO-BASED-SHADOW-NEXT: store i64 42, ptr [[B]], align 8
27 ; ABORT-ZERO-BASED-SHADOW-NEXT: ret void
30 %b = inttoptr i64 0 to i64*