| 1 |
/* Test compilation and CTF generation of anonymous union. An anonymous union |
| 2 |
is encoded as no-name CTF union type. |
| 3 |
|
| 4 |
For this testcase, a single CTF anonymous union is expected. |
| 5 |
struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to |
| 6 |
denote empty string) |
| 7 |
|
| 8 |
Two CTF struct records should be generated in total. |
| 9 |
struct anon_union : ctt_info = 0x1a000001 (1 field) |
| 10 |
union {} : ctt_info = 0x1e000002 (2 fields) */ |
| 11 |
|
| 12 |
/* { dg-do compile } */ |
| 13 |
/* { dg-options "-O0 -gctf -dA" } */ |
| 14 |
|
| 15 |
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */ |
| 16 |
/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ |
| 17 |
/* { dg-final { scan-assembler-times "0x1e000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ |
| 18 |
|
| 19 |
struct anon_union |
| 20 |
{ |
| 21 |
union |
| 22 |
{ |
| 23 |
char name; |
| 24 |
int value; |
| 25 |
}; |
| 26 |
} my_anon_u; |