OSDN Git Service

* gcc.dg/pr34856.c: Condition use of -maltivec on
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pack-test-4.c
1 /* PR c/11885
2    Bug: flag4 was allocated into the same byte as the other flags.
3    { dg-options "" }
4    { dg-do run } */
5
6 extern void abort (void);
7
8 typedef unsigned char uint8_t;
9
10 typedef struct {
11     uint8_t flag1:2;
12     uint8_t flag2:1;
13     uint8_t flag3:1;
14    
15     uint8_t flag4;
16
17 } __attribute__ ((packed)) MyType;
18
19 int main (void)
20 {
21   MyType a;
22   MyType *b = &a;
23
24   b->flag1 = 0;
25   b->flag2 = 0;
26   b->flag3 = 0;
27
28   b->flag4 = 0;
29
30   b->flag4++;
31     
32   if (b->flag1 != 0)
33     abort ();
34
35   return 0;
36 }