1/* debuginfo tests for combinations of const and volatile type qualifiers. */
2/* { dg-do run } */
3/* { dg-options "-g" } */
4
5int i __attribute__((used));
6const int ci __attribute__((used));
7volatile int vi;
8const volatile int cvi;
9
10int *pi __attribute__((used));
11const int *pci __attribute__((used));
12volatile int *pvi __attribute__((used));
13const volatile int *pcvi __attribute__((used));
14
15int * const cip __attribute__((used));
16int * volatile vip;
17int * const volatile cvip;
18
19volatile struct
20{
21  const long cli;
22  const signed char csc;
23} vs;
24
25struct foo
26{
27  const long cli;
28  const signed char csc;
29};
30
31struct bar
32{
33  short s;
34  const short cs;
35  volatile short vs;
36  const volatile short cvs;
37  volatile long long vll;
38};
39
40struct bar bar __attribute__((used));
41struct foo foo __attribute__((used));
42const struct foo cfoo __attribute__((used));
43volatile struct foo vfoo;
44const volatile struct foo cvfoo;
45
46typedef volatile signed char score;
47
48score s;
49const score cs;
50
51static __attribute__((noclone, noinline)) int
52f (const char *progname, volatile struct foo *dummy, const score s)
53{
54  return progname == 0 || dummy == 0 || dummy->csc == s;
55}
56
57int
58main (int argc, char **argv)
59{
60  score as = argc;
61  struct foo dummy = { 1, 1 };
62  return f (argv[0], &dummy, as) - 1;
63}
64
65/* { dg-final { gdb-test 50 "type:main" "int (int, char **)" } } */
66
67/* { dg-final { gdb-test 50 "type:i" "int" } } */
68/* { dg-final { gdb-test 50 "type:ci" "const int" } } */
69/* { dg-final { gdb-test 50 "type:vi" "volatile int" } } */
70/* { dg-final { gdb-test 50 "type:cvi" "const volatile int" } } */
71
72/* { dg-final { gdb-test 50 "type:pi" "int *" } } */
73/* { dg-final { gdb-test 50 "type:pci" "const int *" } } */
74/* { dg-final { gdb-test 50 "type:pvi" "volatile int *" } } */
75/* { dg-final { gdb-test 50 "type:pcvi" "const volatile int *" } } */
76
77/* { dg-final { gdb-test 50 "type:cip" "int * const" } } */
78/* { dg-final { gdb-test 50 "type:vip" "int * volatile" } } */
79/* { dg-final { gdb-test 50 "type:cvip" "int * const volatile" } } */
80
81/* { dg-final { gdb-test 50 "type:vs" "volatile struct { const long cli; const signed char csc; }" } } */
82
83/* { dg-final { gdb-test 50 "type:cvip" "int * const volatile" } } */
84
85/* { dg-final { gdb-test 50 "type:bar" "struct bar { short s; const short cs; volatile short vs; const volatile short cvs; volatile long long vll; }" } } */
86/* { dg-final { gdb-test 50 "type:foo" "struct foo { const long cli; const signed char csc; }" } } */
87/* { dg-final { gdb-test 50 "type:cfoo" "const struct foo { const long cli; const signed char csc; }" } } */
88/* { dg-final { gdb-test 50 "type:vfoo" "volatile struct foo { const long cli; const signed char csc; }" } } */
89/* { dg-final { gdb-test 50 "type:cvfoo" "const volatile struct foo { const long cli; const signed char csc; }" } } */
90
91/* { dg-final { gdb-test 58 "type:s" "volatile signed char" } } */
92/* { dg-final { gdb-test 50 "type:cs" "const volatile signed char" } } */
93
94/* { dg-final { gdb-test 50 "type:f" "int (const char *, volatile struct foo *, const score)" } } */
95