Debian Codegraph @

gcc/testsuite/gnat.dg/warn5.adb

raw
1 -- { dg-do compile }
2
3 with System;
4 with Unchecked_Conversion;
5
6 procedure Warn5 is
7
8 type Digit_Type is range 0..15;
9
10 type Frequency_Type is array( 1..12) of Digit_Type;
11 pragma Pack(Frequency_Type);
12
13 type Element_Type is record
14 F : Frequency_Type;
15 end record;
16
17 type Array_Type is array (Natural range <>) of Element_Type;
18
19 type List_Type is record
20 A : Array_Type (0..1);
21 end record;
22 for List_Type'Alignment use 4;
23
24 type Pointer_Type is access Element_Type;
25 function To_Ptr is new Unchecked_Conversion(System.Address, Pointer_Type);
26
27 function Pointer (Pos : Natural; List : List_Type) return Pointer_Type is
28 begin
29 return To_Ptr(List.A(Pos)'Address); -- { dg-warning "source alignment" "" { target alpha*-*-* arm*-*-* hppa*-*-* ia64-*-* mips*-*-* riscv*-*-* sparc*-*-* } }
30 end;
31
32 begin
33 null;
34 end;