vla.adb 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. -- Copyright 2019-2022 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. procedure Vla is
  16. type Array_Type is array (Natural range <>) of Integer;
  17. type Record_Type (L1, L2 : Natural) is record
  18. I1 : Integer;
  19. A1 : Array_Type (1 .. L1);
  20. I2 : Integer;
  21. A2 : Array_Type (1 .. L2);
  22. I3 : Integer;
  23. end record;
  24. -- Some versions of GCC emit the members in the incorrect order.
  25. -- Since this isn't relevant to the bug at hand, disable
  26. -- reordering to get consistent results.
  27. pragma No_Component_Reordering (Record_Type);
  28. procedure Process (R : Record_Type) is
  29. begin
  30. null;
  31. end Process;
  32. R00 : Record_Type :=
  33. (L1 => 0, L2 => 0,
  34. I1 => 1, A1 => (others => 10),
  35. I2 => 2, A2 => (others => 20),
  36. I3 => 3);
  37. R01 : Record_Type :=
  38. (L1 => 0, L2 => 1,
  39. I1 => 1, A1 => (others => 10),
  40. I2 => 2, A2 => (others => 20),
  41. I3 => 3);
  42. R10 : Record_Type :=
  43. (L1 => 1, L2 => 0,
  44. I1 => 1, A1 => (others => 10),
  45. I2 => 2, A2 => (others => 20),
  46. I3 => 3);
  47. R22 : Record_Type :=
  48. (L1 => 2, L2 => 2,
  49. I1 => 1, A1 => (others => 10),
  50. I2 => 2, A2 => (others => 20),
  51. I3 => 3);
  52. begin
  53. Process (R00); -- Set breakpoint here
  54. Process (R01);
  55. Process (R10);
  56. Process (R22);
  57. end Vla;