constant-gep-call.ll 1014 B

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