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.nest = type { %struct.pair, %struct.pair } 5*9880d681SAndroid Build Coastguard Worker%struct.pair = type { i32, i32 } 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; Nested structure, no arrays, no address-of expressions. 10*9880d681SAndroid Build Coastguard Worker; Verify that the resulting gep-of-gep does not incorrectly trigger 11*9880d681SAndroid Build Coastguard Worker; a safe stack protector. 12*9880d681SAndroid Build Coastguard Worker; safestack attribute 13*9880d681SAndroid Build Coastguard Worker; Requires no protector. 14*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @foo( 15*9880d681SAndroid Build Coastguard Workerdefine void @foo() nounwind uwtable safestack { 16*9880d681SAndroid Build Coastguard Workerentry: 17*9880d681SAndroid Build Coastguard Worker ; CHECK-NOT: __safestack_unsafe_stack_ptr 18*9880d681SAndroid Build Coastguard Worker %c = alloca %struct.nest, align 4 19*9880d681SAndroid Build Coastguard Worker %b = getelementptr inbounds %struct.nest, %struct.nest* %c, i32 0, i32 1 20*9880d681SAndroid Build Coastguard Worker %_a = getelementptr inbounds %struct.pair, %struct.pair* %b, i32 0, i32 0 21*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %_a, align 4 22*9880d681SAndroid Build Coastguard Worker %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %0) 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerdeclare i32 @printf(i8*, ...) 27