1 /* builtin_frame_address(n) with n>0 has always been troublesome ... 2 especially when the S/390 packed stack layout comes into play. */ 3 4 /* { dg-do run } */ 5 /* { dg-options "-O3 -fno-optimize-sibling-calls -mbackchain -mpacked-stack -msoft-float" } */ 6 7 #ifdef __s390x__ 8 /* 64bit: 3 words to be saved: backchain, r14 and r15 */ 9 #define SAVE_AREA_SIZE 3*8 10 #else 11 /* 32bit: 4 words to be saved: backchain, r13, r14 and r15 */ 12 #define SAVE_AREA_SIZE 4*4 13 #endif 14 extern void abort(void); 15 16 #define EXPAND_CHECK(n) \ 17 void __attribute__((noinline)) \ 18 foo1_##n (void *p) \ 19 { \ 20 if (p - __builtin_frame_address (n) != SAVE_AREA_SIZE) \ 21 abort (); \ 22 } \ 23 void __attribute__((noinline)) \ 24 foo2_##n (void *p) \ 25 { \ 26 if (p - __builtin_frame_address (n) != SAVE_AREA_SIZE) \ 27 abort (); \ 28 foo1_##n (__builtin_frame_address (n)); \ 29 } \ 30 void __attribute__((noinline)) \ 31 foo3_##n () \ 32 { \ 33 foo2_##n (__builtin_frame_address (n)); \ 34 } \ 35 void __attribute__((noinline)) \ 36 foo4_##n () \ 37 { \ 38 foo3_##n (); \ 39 } 40 41 EXPAND_CHECK (0) 42 EXPAND_CHECK (1) 43 EXPAND_CHECK (2) 44 45 int main()46main () 47 { 48 foo4_0 (); 49 foo4_1 (); 50 foo4_2 (); 51 52 return 0; 53 } 54