| 1 |
/* Test volatile access to unaligned field. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-fno-strict-volatile-bitfields -fdump-rtl-final" } */ |
| 4 |
|
| 5 |
#define test_type unsigned short |
| 6 |
|
| 7 |
typedef struct s{ |
| 8 |
unsigned char Prefix[1]; |
| 9 |
volatile test_type Type; |
| 10 |
}__attribute((__packed__,__aligned__(4))) ss; |
| 11 |
|
| 12 |
extern volatile ss v; |
| 13 |
|
| 14 |
void |
| 15 |
foo (test_type u) |
| 16 |
{ |
| 17 |
v.Type = u; |
| 18 |
} |
| 19 |
|
| 20 |
/* The C++ memory model forbids data store race conditions outside the |
| 21 |
unaligned data member, therefore only QI or HI access is allowed, no SI. */ |
| 22 |
/* { dg-final { scan-rtl-dump-not "mem/v(/.)*:SI" "final" } } */ |