Debian Codegraph @

gcc/testsuite/gnat.dg/misaligned_volatile.adb

raw
1 -- { dg-do run }
2 -- { dg-options "-gnatp -fstrict-volatile-bitfields" }
3
4 procedure Misaligned_Volatile is
5
6 type Byte is mod 2**8;
7
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;
15
16 type Pair is array (1 .. 2) of Block;
17
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;