1 /* builtin_return_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 void *addr1; 8 9 extern void abort (void); 10 11 void * __attribute__((noinline)) foo1()12foo1 () 13 { 14 addr1 = __builtin_return_address (2); 15 } 16 17 void * __attribute__((noinline)) foo2()18foo2 () 19 { 20 foo1 (); 21 } 22 23 void * __attribute__((noinline)) foo3()24foo3 () 25 { 26 foo2 (); 27 } 28 29 void __attribute__((noinline)) bar()30bar () 31 { 32 void *addr2; 33 34 foo3 (); 35 asm volatile ("basr %0,0\n\t" : "=d" (addr2)); 36 /* basr is two bytes in length. */ 37 if (addr2 - addr1 != 2) 38 abort (); 39 } 40 41 int main()42main () 43 { 44 bar(); 45 return 0; 46 } 47