File: main.c

package info (click to toggle)
llvm-toolchain-3.8 1%3A3.8.1-24
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 379,280 kB
  • ctags: 388,501
  • sloc: cpp: 2,309,705; ansic: 477,070; objc: 100,918; asm: 97,974; python: 95,911; sh: 18,634; makefile: 7,294; perl: 5,584; ml: 5,460; pascal: 4,661; lisp: 2,548; xml: 686; cs: 350; php: 212; csh: 117
file content (67 lines) | stat: -rw-r--r-- 1,946 bytes parent folder | download | duplicates (3)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//===-- main.c --------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <stdint.h>
#include <stdio.h>
int main (int argc, char const *argv[])
{
    struct Bits
    {
        uint32_t    : 1, // Unnamed bitfield
                    b1 : 1,
                    b2 : 2,
                    : 2, // Unnamed bitfield
                    b3 : 3,
                    : 2, // Unnamed bitfield (this will get removed)
                    b4 __attribute__ ((aligned(16))),
                    b5 : 5,
                    b6 : 6,
                    b7 : 7,
                    four : 4;
    };

    printf("%lu", sizeof(struct Bits));

    struct Bits bits;
    int i;
    for (i=0; i<(1<<1); i++)
        bits.b1 = i;        //// break $source:$line
    for (i=0; i<(1<<2); i++)
        bits.b2 = i;        //// break $source:$line
    for (i=0; i<(1<<3); i++)
        bits.b3 = i;        //// break $source:$line
    for (i=0; i<(1<<4); i++)
        bits.b4 = i;        //// break $source:$line
    for (i=0; i<(1<<5); i++)
        bits.b5 = i;        //// break $source:$line
    for (i=0; i<(1<<6); i++)
        bits.b6 = i;        //// break $source:$line
    for (i=0; i<(1<<7); i++)
        bits.b7 = i;        //// break $source:$line
    for (i=0; i<(1<<4); i++)
        bits.four = i;      //// break $source:$line

    struct MoreBits
    {
        uint32_t    a : 3;
        uint8_t       : 1;
        uint8_t     b : 1;
        uint8_t     c : 1;
        uint8_t     d : 1;
    };

    struct MoreBits more_bits;

    more_bits.a = 3;
    more_bits.b = 0;
    more_bits.c = 1;
    more_bits.d = 0;

    return 0;               //// Set break point at this line.

}