RISC-V: Add support for riscv-*-*.
[official-gcc.git] / gcc / testsuite / gnat.dg / debug9.adb
blobec11af1f690fe9138dfdd383304e256886412adc
1 -- The aim of this test is to check that Ada types appear in the proper
2 -- context in the debug info.
3 --
4 -- Checking this directly would be really tedious just scanning for assembly
5 -- lines, so instead we rely on DWARFv4's .debug_types sections, which must be
6 -- created only for global-scope types. Checking the number of .debug_types is
7 -- some hackish way to check that types are output in the proper context (i.e.
8 -- at global or local scope).
9 --
10 -- { dg-skip-if "No dwarf-4 support" { hppa*-*-hpux* } }
11 -- { dg-options "-cargs -gdwarf-4 -fdebug-types-section -dA -margs" }
12 -- { dg-final { scan-assembler-times "\\(DIE \\(0x\[a-f0-9\]*\\) DW_TAG_type_unit\\)" 0 } }
14 procedure Debug9 is
15 type Array_Type is array (Natural range <>) of Integer;
16 type Record_Type (L1, L2 : Natural) is record
17 I1 : Integer;
18 A1 : Array_Type (1 .. L1);
19 I2 : Integer;
20 A2 : Array_Type (1 .. L2);
21 I3 : Integer;
22 end record;
24 function Get (L1, L2 : Natural) return Record_Type is
25 Result : Record_Type (L1, L2);
26 begin
27 Result.I1 := 1;
28 for I in Result.A1'Range loop
29 Result.A1 (I) := I;
30 end loop;
31 Result.I2 := 2;
32 for I in Result.A2'Range loop
33 Result.A2 (I) := I;
34 end loop;
35 Result.I3 := 3;
36 return Result;
37 end Get;
39 R1 : Record_Type := Get (0, 0);
40 R2 : Record_Type := Get (1, 0);
41 R3 : Record_Type := Get (0, 1);
42 R4 : Record_Type := Get (2, 2);
44 procedure Process (R : Record_Type) is
45 begin
46 null;
47 end Process;
49 begin
50 Process (R1);
51 Process (R2);
52 Process (R3);
53 Process (R4);
54 end Debug9;