1 ; RUN: opt < %s -asan -asan-module -asan-use-after-return -S | FileCheck --check-prefix=CHECK-UAR %s 2 ; RUN: opt < %s -asan -asan-module -asan-use-after-return=0 -S | FileCheck --check-prefix=CHECK-PLAIN %s 3 target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128" 4 target triple = "x86_64-unknown-linux-gnu" 5 6 declare void @Foo(i8*) 7 8 define void @Bar() uwtable sanitize_address { 9 entry: 10 ; CHECK-PLAIN-LABEL: Bar 11 ; CHECK-PLAIN-NOT: label 12 ; CHECK-PLAIN: ret void 13 14 ; CHECK-UAR-LABEL: Bar 15 ; CHECK-UAR: load i32* @__asan_option_detect_stack_use_after_return 16 ; CHECK-UAR: label 17 ; CHECK-UAR: call i64 @__asan_stack_malloc_1 18 ; CHECK-UAR: label 19 ; CHECK-UAR: call void @Foo 20 ; If LocalStackBase != OrigStackBase 21 ; CHECK-UAR: label 22 ; Then Block: poison the entire frame. 23 ; CHECK-UAR: store i64 -723401728380766731 24 ; CHECK-UAR: store i64 -723401728380766731 25 ; CHECK-UAR: store i8 0 26 ; CHECK-UAR-NOT: store 27 ; CHECK-UAR: label 28 ; Else Block: no UAR frame. Only unpoison the redzones. 29 ; CHECK-UAR: store i64 0 30 ; CHECK-UAR: store i32 0 31 ; CHECK-UAR-NOT: store 32 ; CHECK-UAR: label 33 ; Done, no more stores. 34 ; CHECK-UAR-NOT: store 35 ; CHECK-UAR: ret void 36 37 %x = alloca [20 x i8], align 16 38 %arraydecay = getelementptr inbounds [20 x i8]* %x, i64 0, i64 0 39 call void @Foo(i8* %arraydecay) 40 ret void 41 } 42 43 44