summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20141029-1.c
blob: 4a5d92efa732e9b71f52b727af2d1d1cf05fc84d (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
/* { dg-do compile } */
/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */

#define PERIPH (*(volatile struct system_periph *)0x81234)

struct system_periph {
  union {
    unsigned short WORD;
    struct {
      unsigned short a:1;
      unsigned short b:1;
      unsigned short  :5;
      unsigned short c:1;
      unsigned short  :8;
    } BIT;
  } ALL;
} __attribute__((aligned(2)));

void
foo()
{
  while (1)
    {
      PERIPH.ALL.BIT.a = 1;
    }
}
/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:HI" 4 "final" } } */