1--  Copyright 2019-2023 Free Software Foundation, Inc.
2--
3--  This program is free software; you can redistribute it and/or modify
4--  it under the terms of the GNU General Public License as published by
5--  the Free Software Foundation; either version 3 of the License, or
6--  (at your option) any later version.
7--
8--  This program is distributed in the hope that it will be useful,
9--  but WITHOUT ANY WARRANTY; without even the implied warranty of
10--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11--  GNU General Public License for more details.
12--
13--  You should have received a copy of the GNU General Public License
14--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16procedure Vla is
17   type Array_Type is array (Natural range <>) of Integer;
18   type Record_Type (L1, L2 : Natural) is record
19      I1 : Integer;
20      A1 : Array_Type (1 .. L1);
21      I2 : Integer;
22      A2 : Array_Type (1 .. L2);
23      I3 : Integer;
24   end record;
25
26   -- Some versions of GCC emit the members in the incorrect order.
27   -- Since this isn't relevant to the bug at hand, disable
28   -- reordering to get consistent results.
29   pragma No_Component_Reordering (Record_Type);
30
31   procedure Process (R : Record_Type) is
32   begin
33      null;
34   end Process;
35
36   R00 : Record_Type :=
37     (L1 => 0, L2 => 0,
38      I1 => 1, A1 => (others => 10),
39      I2 => 2, A2 => (others => 20),
40      I3 => 3);
41   R01 : Record_Type :=
42     (L1 => 0, L2 => 1,
43      I1 => 1, A1 => (others => 10),
44      I2 => 2, A2 => (others => 20),
45      I3 => 3);
46   R10 : Record_Type :=
47     (L1 => 1, L2 => 0,
48      I1 => 1, A1 => (others => 10),
49      I2 => 2, A2 => (others => 20),
50      I3 => 3);
51   R22 : Record_Type :=
52     (L1 => 2, L2 => 2,
53      I1 => 1, A1 => (others => 10),
54      I2 => 2, A2 => (others => 20),
55      I3 => 3);
56
57begin
58   Process (R00); -- Set breakpoint here
59   Process (R01);
60   Process (R10);
61   Process (R22);
62end Vla;
63