Debian Codegraph @

gcc/testsuite/gnat.dg/scalar_mode_agg_compare.adb

raw
1 -- { dg-do run }
2
3 procedure Scalar_Mode_Agg_Compare is
4
5 type Point is record
6 Mapped : Boolean;
7 Tag : String (1 .. 2); -- HImode
8 end record;
9 pragma Pack (Point); -- Tag possibly at bitpos 1
10
11 function My_Point return Point is
12 begin
13 return (Mapped => True, Tag => "XX");
14 end;
15
16 A, B : Point := My_Point;
17 begin
18 -- The comparison below should find the two Tag fields equal and not
19 -- attempt to take their address, which might not be byte aligned.
20
21 if A.Tag /= B.Tag then
22 raise Program_Error;
23 end if;
24 end;
25