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
4@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
5
6; Address-of local taken (j = &a)
7; Requires protector.
8
9define void @foo() nounwind uwtable safestack {
10entry:
11  ; CHECK: __safestack_unsafe_stack_ptr
12  %retval = alloca i32, align 4
13  %a = alloca i32, align 4
14  %j = alloca i32*, align 8
15  store i32 0, i32* %retval
16  %0 = load i32, i32* %a, align 4
17  %add = add nsw i32 %0, 1
18  store i32 %add, i32* %a, align 4
19  store i32* %a, i32** %j, align 8
20  ret void
21}
22
23