1 /* PR debug/41353 */
2 /* { dg-do run } */
3 /* { dg-options "-g" } */
4
5 int vari __attribute__((used)) = 17, varj;
6
7 __attribute__((noinline)) int
f1(void)8 f1 (void)
9 {
10 /* { dg-final { gdb-test 17 "vari" "17" } } */
11 int vari1 = 2 * vari; /* { dg-final { gdb-test 17 "vari1" "2 * 17" } } */
12 int vari2 = 3 * vari; /* { dg-final { gdb-test 17 "vari2" "3 * 17" } } */
13 int vari3 = 2 * vari; /* { dg-final { gdb-test 17 "vari3" "2 * 17" } } */
14 int vari4 = 3 * vari; /* { dg-final { gdb-test 17 "vari4" "3 * 17" } } */
15 int vari5 = 4 * vari; /* { dg-final { gdb-test 17 "vari5" "4 * 17" } } */
16 int vari6 = 5 * vari; /* { dg-final { gdb-test 17 "vari6" "5 * 17" } } */
17 return varj;
18 }
19
20 __attribute__((noinline)) int
f2(int i,int j)21 f2 (int i, int j)
22 {
23 j += i;
24 /* { dg-final { gdb-test 28 "i" "37" } } */
25 /* { dg-final { gdb-test 28 "j" "28 + 37" { xfail *-*-* } } } */
26 int i1 = 2 * i; /* { dg-final { gdb-test 28 "i1" "2 * 37" } } */
27 int i2 = 3 * i; /* { dg-final { gdb-test 28 "i2" "3 * 37" } } */
28 return j;
29 }
30
31 __attribute__((noinline)) int
f3(int i)32 f3 (int i)
33 {
34 asm volatile ("" : "+r" (i));
35 /* { dg-final { gdb-test 39 "i" "12" } } */
36 int i1 = 2 * i; /* { dg-final { gdb-test 39 "i1" "2 * 12" } } */
37 int i2 = 2 * i; /* { dg-final { gdb-test 39 "i2" "2 * 12" } } */
38 int i3 = 3 * i; /* { dg-final { gdb-test 39 "i3" "3 * 12" } } */
39 return i;
40 }
41
42 int (*volatile fnp1) (void) = f1;
43 int (*volatile fnp2) (int, int) = f2;
44 int (*volatile fnp3) (int) = f3;
45
46 int
main(int argc,char * argv[])47 main (int argc, char *argv[])
48 {
49 asm volatile ("" : : "r" (&fnp1) : "memory");
50 asm volatile ("" : : "r" (&fnp2) : "memory");
51 asm volatile ("" : : "r" (&fnp3) : "memory");
52 fnp1 ();
53 fnp2 (37, 28);
54 fnp3 (12);
55 return 0;
56 }
57