PR target/84336
[official-gcc.git] / gcc / testsuite / gnat.dg / scalar_mode_agg_compare.adb
blobff373464282b6918ca2833deceb6518a5a943d5d
1 -- { dg-do run }
3 procedure Scalar_Mode_Agg_Compare is
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
11 function My_Point return Point is
12 begin
13 return (Mapped => True, Tag => "XX");
14 end;
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.
21 if A.Tag /= B.Tag then
22 raise Program_Error;
23 end if;
24 end;