2016-11-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / misaligned_volatile.adb
blobc76975b3ecd840efd695191574fbc99850ce4d4b
1 -- { dg-do run }
2 -- { dg-options "-gnatp -fstrict-volatile-bitfields" }
4 procedure Misaligned_Volatile is
6 type Byte is mod 2**8;
8 type Block is record
9 B : Boolean;
10 V : Byte;
11 end record;
12 pragma Volatile (Block);
13 pragma Pack (Block);
14 for Block'Alignment use 1;
16 type Pair is array (1 .. 2) of Block;
18 P : Pair;
19 begin
20 for K in P'Range loop
21 P(K).V := 237;
22 end loop;
23 for K in P'Range loop
24 if P(K).V /= 237 then
25 raise Program_error;
26 end if;
27 end loop;
28 end;