Debian Codegraph @

gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c

raw
1 /* BTF generation for array type.
2
3 Unsized arrays are encoded with a 0 for the number of elements.
4
5 In this testcase, 5 distinct BTF records for arrays are expected
6 b1 : cta_nelems = 2
7 c1 : cta_nelems = 3
8 a1 : cta_nelems = 2, 5
9 buf : cta_nelems = 0. */
10
11 /* { dg-do compile } */
12 /* { dg-options "-O0 -gbtf -dA" } */
13
14 /* { dg-final { scan-assembler-times "0x3000000\[\t \]+\[^\n\]*btt_info" 5 } } */
15
16 /* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*bta_nelems" 2 } } */
17 /* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*bta_nelems" 1 } } */
18 /* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*bta_nelems" 1 } } */
19 /* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 } } */
20
21 /* { dg-final { scan-assembler-times " bta_elem_type: \\(BTF_KIND_INT 'int'\\)" 4 } } */
22 /* { dg-final { scan-assembler-times " bta_elem_type: \\(BTF_KIND_ARRAY ''\\)" 1 } } */
23
24 int b1[2] = {0,1};
25 int c1[5] = {0,1,2,3,4};
26 int a1[2][3] = { {3,4,5}, {2,3,4} };
27
28 /* Variable length struct using arrays. */
29 struct my_array
30 {
31 int flags;
32 int length;
33 int buf[];
34 } my_array_obj;