1 /* Test -funsigned-bitfields works. */
2 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-options "-funsigned-bitfields -fsigned-char" } */
7 typedef signed char sc;
8 typedef unsigned char uc;
10 typedef signed short ss;
11 typedef unsigned short us;
14 typedef signed int si;
15 typedef unsigned int ui;
17 typedef signed long sl;
18 typedef unsigned long ul;
20 typedef signed long long sll;
21 typedef unsigned long long ull;
44 signed char schar0 : 1;
47 unsigned char uchar0 : 1;
53 signed short sshort0 : 1;
56 unsigned short ushort0 : 1;
59 __attribute__((dummy)) int0 : 1; /* { dg-warning "attribute directive ignored" } */
68 unsigned int uint0 : 1;
74 signed long slong0 : 1;
77 unsigned long ulong0 : 1;
83 signed long long sllong0 : 1;
86 unsigned long long ullong0 : 1;
93 extern void abort (void);
94 extern void exit (int);
95 extern void *memset (void *, int, __SIZE_TYPE__);
100 memset (&x, (unsigned char)-1, sizeof(x));
101 if (x.char0 != 1 || x.char1 != 1 || x.char2 != 1
102 || x.schar0 != -1 || x.schar1 != -1 || x.schar2 != -1
103 || x.uchar0 != 1 || x.uchar1 != 1 || x.uchar2 != 1
104 || x.short0 != 1 || x.short1 != 1 || x.short2 != 1
105 || x.sshort0 != -1 || x.sshort1 != -1 || x.sshort2 != -1
106 || x.ushort0 != 1 || x.ushort1 != 1 || x.ushort2 != 1
107 || x.int0 != 1 || x.int1 != 1 || x.int2 != 1
108 || x.int3 != 1 || x.int4 != 1 || x.int5 != 1
109 || x.sint0 != -1 || x.sint1 != -1 || x.sint2 != -1
110 || x.uint0 != 1 || x.uint1 != 1 || x.uint2 != 1
111 || x.long0 != 1 || x.long1 != 1 || x.long2 != 1
112 || x.slong0 != -1 || x.slong1 != -1 || x.slong2 != -1
113 || x.ulong0 != 1 || x.ulong1 != 1 || x.ulong2 != 1
114 || x.llong0 != 1 || x.llong1 != 1 || x.llong2 != 1
115 || x.sllong0 != -1 || x.sllong1 != -1 || x.sllong2 != -1
116 || x.ullong0 != 1 || x.ullong1 != 1 || x.ullong2 != 1)