• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- main.c --------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #include <stdint.h>
10 #include <stdio.h>
main(int argc,char const * argv[])11 int main (int argc, char const *argv[])
12 {
13     struct Bits
14     {
15         uint32_t    : 1, // Unnamed bitfield
16                     b1 : 1,
17                     b2 : 2,
18                     : 2, // Unnamed bitfield
19                     b3 : 3,
20                     : 2, // Unnamed bitfield (this will get removed)
21                     b4 __attribute__ ((align(16))),
22                     b5 : 5,
23                     b6 : 6,
24                     b7 : 7,
25                     four : 4;
26     };
27 
28     printf("%lu", sizeof(struct Bits));
29 
30     struct Bits bits;
31     int i;
32     for (i=0; i<(1<<1); i++)
33         bits.b1 = i;        //// break $source:$line
34     for (i=0; i<(1<<2); i++)
35         bits.b2 = i;        //// break $source:$line
36     for (i=0; i<(1<<3); i++)
37         bits.b3 = i;        //// break $source:$line
38     for (i=0; i<(1<<4); i++)
39         bits.b4 = i;        //// break $source:$line
40     for (i=0; i<(1<<5); i++)
41         bits.b5 = i;        //// break $source:$line
42     for (i=0; i<(1<<6); i++)
43         bits.b6 = i;        //// break $source:$line
44     for (i=0; i<(1<<7); i++)
45         bits.b7 = i;        //// break $source:$line
46     for (i=0; i<(1<<4); i++)
47         bits.four = i;      //// break $source:$line
48 
49     struct MoreBits
50     {
51         uint32_t    a : 3;
52         uint8_t       : 1;
53         uint8_t     b : 1;
54         uint8_t     c : 1;
55         uint8_t     d : 1;
56     };
57 
58     struct MoreBits more_bits;
59 
60     more_bits.a = 3;
61     more_bits.b = 0;
62     more_bits.c = 1;
63     more_bits.d = 0;
64 
65     return 0;               //// Set break point at this line.
66 
67 }
68