blob: 6468a761dd574dbf75d3de1a0a401c390fe11273 [file] [log] [blame]
Peter Collingbourne82437bf2015-06-15 21:07:11 +00001; 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%class.A = type { [2 x i8] }
5
6@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
7
8; [2 x i8] in a class
9; safestack attribute
10; Requires no protector.
11; CHECK-LABEL: @foo(
12define signext i8 @foo() nounwind uwtable safestack {
13entry:
14 ; CHECK-NOT: __safestack_unsafe_stack_ptr
15 %a = alloca %class.A, align 1
16 %array = getelementptr inbounds %class.A, %class.A* %a, i32 0, i32 0
17 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0
18 %0 = load i8, i8* %arrayidx, align 1
19 ret i8 %0
20}