1*9880d681SAndroid Build Coastguard Worker; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker%struct.deep = type { %union.anon } 5*9880d681SAndroid Build Coastguard Worker%union.anon = type { %struct.anon } 6*9880d681SAndroid Build Coastguard Worker%struct.anon = type { %struct.anon.0 } 7*9880d681SAndroid Build Coastguard Worker%struct.anon.0 = type { %union.anon.1 } 8*9880d681SAndroid Build Coastguard Worker%union.anon.1 = type { [2 x i8] } 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker; [2 x i8] nested in several layers of structs and unions 13*9880d681SAndroid Build Coastguard Worker; safestack attribute 14*9880d681SAndroid Build Coastguard Worker; Requires no protector. 15*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foo( 16*9880d681SAndroid Build Coastguard Workerdefine signext i8 @foo() nounwind uwtable safestack { 17*9880d681SAndroid Build Coastguard Workerentry: 18*9880d681SAndroid Build Coastguard Worker ; CHECK-NOT: __safestack_unsafe_stack_ptr 19*9880d681SAndroid Build Coastguard Worker %x = alloca %struct.deep, align 1 20*9880d681SAndroid Build Coastguard Worker %b = getelementptr inbounds %struct.deep, %struct.deep* %x, i32 0, i32 0 21*9880d681SAndroid Build Coastguard Worker %c = bitcast %union.anon* %b to %struct.anon* 22*9880d681SAndroid Build Coastguard Worker %d = getelementptr inbounds %struct.anon, %struct.anon* %c, i32 0, i32 0 23*9880d681SAndroid Build Coastguard Worker %e = getelementptr inbounds %struct.anon.0, %struct.anon.0* %d, i32 0, i32 0 24*9880d681SAndroid Build Coastguard Worker %array = bitcast %union.anon.1* %e to [2 x i8]* 25*9880d681SAndroid Build Coastguard Worker %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %array, i32 0, i64 0 26*9880d681SAndroid Build Coastguard Worker %0 = load i8, i8* %arrayidx, align 1 27*9880d681SAndroid Build Coastguard Worker ret i8 %0 28*9880d681SAndroid Build Coastguard Worker} 29