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