Debian Codegraph @

gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c

raw
1 /* Test BTF generation of BTF_KIND_{CONST,VOLATILE,RESTRICT} records.
2
3 BTF const, volatile and restrict records are nameless type records pointing
4 to the type they modify.
5
6 Types:
7 [1] int 'int' size=4U offset=0 bits=32 SIGNED
8 [2] const <anonymous> type=1
9 [3] volatile <anonymous> type=1
10 [4] const <anonymous> type=3
11 [5] ptr <anonymous> type=1
12 [6] restrict <anonymous> type=5
13 [7] ptr <anonymous> type=2
14 [8] restrict <anonymous> type=7
15
16 Note:
17 - Type id 3 describes a volatile int.
18 - Type id 2 describes a const int.
19 - Type id 4 describes a const volatile int by modifying id 3.
20 - Type id 6 describes a restrict pointer to int.
21 - Type id 8 describes a restrict pointer to const int.
22 */
23
24 /* { dg-do compile } */
25 /* { dg-options "-O0 -gbtf -dA" } */
26 /* { dg-additional-options "-gdwarf-4" { target { *-*-darwin* } } } */
27
28 /* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
29
30 /* types 5 and 7 are pointers, to 'int' and 'const int' respectively. */
31 /* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */
32
33 /* type 3 has VOLATILE qualifier */
34 /* { dg-final { scan-assembler-times "\[\t \]0x9000000\[\t \]+\[^\n\]*btt_info" 1 } } */
35
36 /* types 2 and 4 have CONST qualifier. */
37 /* { dg-final { scan-assembler-times "\[\t \]0xa000000\[\t \]+\[^\n\]*btt_info" 2 } } */
38
39 /* types 6 and 8 have RESTRICT qualifier. */
40 /* { dg-final { scan-assembler-times "\[\t \]0xb000000\[\t \]+\[^\n\]*btt_info" 2 } } */
41
42 const int a = 10;
43
44 volatile int b;
45
46 int * restrict c;
47
48 const volatile int d = 20;
49
50 const int * restrict e;
51
52 const int * f;
53 int const * g;