OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [pack-test-4.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.