diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr48784-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr48784-1.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr48784-1.c b/gcc/testsuite/gcc.dg/pr48784-1.c new file mode 100644 index 00000000000..bbcad9b18ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48784-1.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +#pragma pack(1) +volatile struct S0 { + signed a : 7; + unsigned b : 28; /* b can't be fetched with an aligned 32-bit access, */ + /* but it certainly can be fetched with an unaligned access */ +} g = {0,0xfffffff}; + +int main() { + unsigned b = g.b; + if (b != 0xfffffff) + abort (); + return 0; +} |