2015-05-04 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr56997-4.c
blob38f6248d2ed59681a715527948faa6264780744f
1 /* Test volatile access to unaligned field. */
2 /* { dg-do compile } */
3 /* { dg-options "-fno-strict-volatile-bitfields -fdump-rtl-final" } */
5 #define test_type unsigned short
7 typedef struct s{
8 unsigned char Prefix[1];
9 volatile test_type Type;
10 }__attribute((__packed__,__aligned__(4))) ss;
12 extern volatile ss v;
14 void
15 foo (test_type u)
17 v.Type = u;
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" } } */
23 /* { dg-final { cleanup-rtl-dump "final" } } */