summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/sso/s12.adb
blob: f9c4adeb71b5b82b8d0a0ad3216380a7d40fa557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-- { dg-do run }

with Init12; use Init12;
with Text_IO; use Text_IO;
with Dump;

procedure S12 is

  A11 : Arr11 := My_A11;
  A22 : Arr22 := My_A22;

  A1 : Arr1;
  A2 : Arr2;

  C1 : Integer;
  C2 : Integer;
  C3 : Integer;

begin
  Put ("A11 :");
  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
  New_Line;
  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }

  Put ("A22 :");
  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
  New_Line;
  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }

  A1 := (A11(1,1), A11(1,2), A11(2,1));
  C1 := A1(1);
  C2 := A1(2);
  C3 := A1(3);

  Put_Line("C1 :" & C1'Img);
  -- { dg-output "C1 : 11206674.*\n" }

  Put_Line("C2 :" & C2'Img);
  -- { dg-output "C2 : 13434932.*\n" }

  Put_Line("C3 :" & C3'Img);
  -- { dg-output "C3 : 11206674.*\n" }

  A1(1) := C1;
  A1(2) := C2;
  A1(3) := C3;
  A11(1,1) := A1(1); A11(1,2) := A1(2); A11(2,1) := A1(3);

  A2 := (A22(1,1), A22(1,2), A22(2,1));
  C1 := A2(1);
  C2 := A2(2);
  C3 := A2(3);

  Put_Line("C1 :" & C1'Img);
  -- { dg-output "C1 : 11206674.*\n" }

  Put_Line("C2 :" & C2'Img);
  -- { dg-output "C2 : 13434932.*\n" }

  Put_Line("C3 :" & C3'Img);
  -- { dg-output "C3 : 11206674.*\n" }

  A2(1) := C1;
  A2(2) := C2;
  A2(3) := C3;
  A22(1,1) := A2(1); A22(1,2) := A2(2); A22(2,1) := A2(3);

  Put ("A11 :");
  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
  New_Line;
  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }

  Put ("A22 :");
  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
  New_Line;
  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
end;