aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/bitreverse-17.c
blob: bfc0c0f5a3487f4516bd05660b511a9523bf63ba (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
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
68
69
70
71
72
/* APPLE LOCAL file 4420068 */
/* Exercise zero-length fields. */

/* { dg-do run { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */

#pragma reverse_bitfields on
struct empty {};

struct uc0 { unsigned char content[0]; };

struct nest_uc0 { struct uc0 foo; };

struct uc0_uib2 { unsigned char foo[0]; unsigned int xx : 2; };

struct nest_nest_uc0_uib3 { struct nest_uc0 xx; unsigned int yy : 3; };

struct nest_empty_uib3 { struct empty e; unsigned int zz : 3; };

union size0 { struct empty e; int i[0]; };

union u0 { struct uc0 ss; unsigned int i; };

union u1 { struct nest_uc0 ss; unsigned int i; };

union u2 { struct uc0_uib2 ss; unsigned int i; };

union u3 { struct nest_nest_uc0_uib3 ss; unsigned int i; };

union u4 { struct nest_empty_uib3 ss; unsigned int i; };

union u5 { union size0 ss; unsigned int i; };

struct advance {
  char c;
  int spacer[0];
  char d;
};

struct advance2 {
  char c;
  struct empty s;
  char d;
};

struct advance3 {
  char c;
  union size0 u;
  char d;
};

int main() {
  
  if (sizeof(struct empty) !=0 ||
    sizeof(struct uc0) !=0 
    || sizeof(struct uc0_uib2) != 4
    || sizeof(struct nest_nest_uc0_uib3) != 4
    || sizeof(struct nest_empty_uib3) != 4
    || sizeof(union size0) != 0
    || sizeof(union u0) != 4
    || sizeof(union u1) != 4
    || sizeof(union u2) != 4
    || sizeof(union u3) != 4
    || sizeof(union u4) != 4
    || sizeof(union u5) != 4
    || sizeof(struct advance) != 8
    || sizeof(struct advance2) != 2
    || sizeof(struct advance3) != 8)
    return 42;
  return 0;
}