1 /* PR debug/68860 */
2 /* { dg-do run } */
3 /* { dg-options "-g" } */
4 
5 #include "../nop.h"
6 
7 static int __attribute__((noinline))
foo(int arg1,int arg2,int arg3,int arg4,int arg5,int arg6,int arg7,int arg8)8 foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8)
9 {
10   char *x = __builtin_alloca (arg7);
11   int __attribute__ ((aligned(32))) y;
12 
13   y = 2;
14   asm (NOP : "=m" (y) : "m" (y));
15   x[0] = 25 + arg8;
16   asm volatile (NOP : "=m" (x[0]) : "m" (x[0]));
17   return y;
18 }
19 
20 /* On s390(x) r2 and r3 are (depending on the optimization level) used
21    when adjusting the addresses in order to meet the alignment
22    requirements above.  They usually hold the function arguments arg1
23    and arg2.  So it is expected that these values are unavailable in
24    some of these tests.  */
25 
26 /* { dg-final { gdb-test 14 "arg1" "1" { target { ! "s390*-*-*" } } } } */
27 /* { dg-final { gdb-test 14 "arg2" "2" { target { ! "s390*-*-*" } } } } */
28 /* { dg-final { gdb-test 14 "arg3" "3" } } */
29 /* { dg-final { gdb-test 14 "arg4" "4" } } */
30 /* { dg-final { gdb-test 14 "arg5" "5" } } */
31 /* { dg-final { gdb-test 14 "arg6" "6" } } */
32 /* { dg-final { gdb-test 14 "arg7" "30" } } */
33 /* { dg-final { gdb-test 14 "arg8" "7" } } */
34 /* { dg-final { gdb-test 14 "y" "2" } } */
35 /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */
36 /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */
37 /* { dg-final { gdb-test 16 "arg3" "3" } } */
38 /* { dg-final { gdb-test 16 "arg4" "4" } } */
39 /* { dg-final { gdb-test 16 "arg5" "5" } } */
40 /* { dg-final { gdb-test 16 "arg6" "6" } } */
41 /* { dg-final { gdb-test 16 "arg7" "30" } } */
42 /* { dg-final { gdb-test 16 "arg8" "7" } } */
43 /* { dg-final { gdb-test 16 "*x" "(char) 32" } } */
44 /* { dg-final { gdb-test 16 "y" "2" } } */
45 
46 int
main()47 main ()
48 {
49   int l = 0;
50   asm volatile ("" : "=r" (l) : "0" (l));
51   foo (l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 30, 7);
52   asm volatile ("" :: "r" (l));
53   return 0;
54 }
55