aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/bitreverse-20.c
blob: 5e7726d3416aa44bf7ed68120f27e1b3f7a83262 (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
/* APPLE LOCAL file 4430139 */
/* Same as bitreverse-19 without #pragma pack; it makes 
   no difference in this case. */

extern void abort();
/* { dg-do run { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */
typedef unsigned short WORD;
typedef unsigned int DWORD;

#pragma reverse_bitfields on

#define USE_STRUCT_WRAPPER 0

typedef struct 
{
   short a : 6;
   int b : 10;
   int c : 22;
} Foo;
typedef union { Foo x; int y[6]; } u1;

int main(int argc, char* argv[])
{
    int i;
    u1 U;
    for (i=0; i<6; i++)
	U.y[i] = 0;
    U.x.a = 1;
    U.x.b = 3;
    U.x.c = 5;

    if (sizeof(Foo) != 8 
        || U.y[0] != 0x000100c0
	|| U.y[1] != 0x00000005)
    abort();
   return 0;
}