File: pr23623.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (47 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (6)
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
/* { 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;
} __attribute__((aligned(4))) bf1;

extern volatile struct
{
  unsigned int b : 1;
  unsigned int : 31;
} __attribute__((aligned(4))) bf2;

extern struct
{
  volatile unsigned int b : 1;
  volatile unsigned int : 31;
} __attribute__((aligned(4))) 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" } } */