1 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3 ; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
6 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
8 ; no safestack attribute
9 ; Requires no protector.
11 ; CHECK-NOT: __safestack_unsafe_stack_ptr
14 define void @foo(ptr %a) nounwind uwtable {
16 ; CHECK-NOT: __safestack_unsafe_stack_ptr
17 %a.addr = alloca ptr, align 8
18 %buf = alloca [16 x i8], align 16
19 store ptr %a, ptr %a.addr, align 8
20 %0 = load ptr, ptr %a.addr, align 8
21 %call = call ptr @strcpy(ptr %buf, ptr %0)
22 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf)
26 declare ptr @strcpy(ptr, ptr)
27 declare i32 @printf(ptr, ...)