aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr23623.c
blob: 7ba1470182dcd7aea0eb01f5fcdbe7e994daf37c (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
39
40
41
42
43
44
45
46
47
48
/* { dg-do compile } */
/* { dg-require-effective-target size32plus } */
/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */

/* With -fstrict-volatile-bitfields, the volatile accesses to bf2.b
   and bf3.b must do unsigned int reads/writes.  The non-volatile
   accesses to bf1.b are not so constrained.  */

extern struct
{
  unsigned int b : 1;
  unsigned int : 31;
} bf1;

extern volatile struct
{
  unsigned int b : 1;
  unsigned int : 31;
} bf2;

extern struct
{
  volatile unsigned int b : 1;
  volatile unsigned int : 31;
} bf3;

void writeb(void)
{
  bf1.b = 1;
  bf2.b = 1;	/* volatile read + volatile write */
  bf3.b = 1;	/* volatile read + volatile write */
}

extern unsigned int x1, x2, x3;

void readb(void)
{
  x1 = bf1.b;
  x2 = bf2.b;   /* volatile write */
  x3 = bf3.b;   /* volatile write */
}

/* There should be 6 volatile MEMs total, but scan-rtl-dump-times counts
   the number of match variables and not the number of matches.  Since
   the parenthesized subexpression in the regexp introduces an extra match
   variable, we need to give a count of 12 instead of 6 here.  */
/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:SI" 12 "final" } } */
/* { dg-final { cleanup-rtl-dump "final" } } */