aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
blob: aea09219dba6f1929dd5ff69bf83a86e081c6d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* The bitfield type (int) may be shared, but slices are not de-duplicated.

   In this testcase, it is expected to see a total of 6 CTF slices and 2 CTF
   integer types for the bitfields - unsigned long long and signed long long.
   
   cts_offset is the offset of the bitfield into a machine word.
   TBD - hardcoding cts_offset checks into the testcase will cause it to break
   across targets with different BIT_PER_WORD.  Is there a way to add
   cts_offset related checks in the testcase?  */

/* { dg-do compile )  */
/* { dg-options "-O0 -gctf -dA" } */

/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*cts_type" 3 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 3 } } */

/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*cts_bits" 2 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x21\[\t \]+\[^\n\]*cts_bits" 2 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x10\[\t \]+\[^\n\]*cts_bits" 2 } } */

/* { dg-final { scan-assembler-times "ascii \"long long unsigned int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \"long long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */

struct fields
{
  unsigned long long u1 : 15;
  unsigned long long u2 : 33;
  unsigned long long u3 : 16;
  signed long long   s1 : 15;
  signed long long   s2 : 33;
  signed long long   s3 : 16;
} flags;

int i = 33;

int main ()
{
    return flags.u1 + i;
}