file_text stringlengths 1 2.1M ⌀ | language stringclasses 416
values | file_name stringlengths 1 185 ⌀ |
|---|---|---|
-- { dg-do run }
with Ada.Tags; use Ada.Tags;
with Ada.Text_IO; use Ada.Text_IO;
procedure aggr3 is
package Pkg is
type Element is interface;
type Event is tagged record
V1 : Natural;
V2 : Natural;
end record;
function Create return Event;
type D_Event is new Even... | Ada | aggr3.adb |
-- { dg-do compile }
with Aggr3_Pkg; use Aggr3_Pkg;
package Aggr3 is
type Enum is (One);
type R (D : Enum := One) is
record
case D is
when One => The_T : T;
end case;
end record;
My_R : R := (D => One, The_T => My_T);
end Aggr3;
| Ada | aggr3.ads |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
package body Aggr30 is
Null_Constant : constant Rec := (Data => (others => 0),
Padding => (others => 0));
procedure Init is
begin
Instance := Null_Constant;
end;
procedure Init_Volatile is
begin
... | Ada | aggr30.adb |
with Interfaces;
package Aggr30 is
type Data_Type is array (1 .. 4) of Interfaces.Unsigned_8;
type Padding_Type is array (5 .. 4096) of Interfaces.Unsigned_8;
type Rec is record
Data : Data_Type;
Padding : Padding_Type;
end record;
procedure Init;
procedure Init_Volatile;
private... | Ada | aggr30.ads |
package Aggr3_Pkg is
type Root is abstract tagged null record;
type T is new Root with null record;
My_T : T;
end Aggr3_Pkg;
| Ada | aggr3_pkg.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
procedure aggr4 is
type Byte is range 0 .. 2**8 - 1;
for Byte'Size use 8;
type Time is array (1 .. 3) of Byte;
type UTC_Time is record
Values : Time;
end record;
type Local_Time is record
Values : Time;
end record;... | Ada | aggr4.adb |
-- { dg-do compile }
with Aggr4_Pkg; use Aggr4_Pkg;
package Aggr4 is
C : constant Rec3 := (Data => (D => One, Value => Zero));
end Aggr4;
| Ada | aggr4.ads |
-- { dg-excess-errors "cannot generate code" }
package Aggr4_Pkg is
function F return Integer;
type Rec1 is tagged record
I : Integer;
end record;
Zero : constant Rec1 := (I => F);
type Enum is (One, Two);
type Rec2 (D : Enum := One) is record
case D is
when One => Value : R... | Ada | aggr4_pkg.ads |
-- { dg-do compile }
pragma Restrictions (No_Elaboration_Code);
package Aggr5 is
type R is record
C : Character;
F : Float;
end record;
for R use record
C at 0 range 0 .. 7;
F at 1 range 0 .. 31;
end record;
My_R : R := (C => 'A', F => 1.0);
end Aggr5;
| Ada | aggr5.ads |
-- { dg-do compile }
package Aggr6 is
type B15_T is mod 2 ** 15;
for B15_T'Size use 15;
for B15_T'Alignment use 1;
type B17_T is mod 2 ** 17;
for B17_T'Size use 17;
for B17_T'Alignment use 1;
type Rec_T is record
A : B17_T;
B : B15_T;
end record;
for Rec_T use record
A... | Ada | aggr6.ads |
-- { dg-do compile }
procedure aggr7 is
package P is
type T is limited private;
type TT is limited private;
type TTT is tagged limited private;
private
type T is limited
record
Self : access T := T'Unchecked_Access;
end record;
type TT is tagged... | Ada | aggr7.adb |
-- { dg-do compile }
procedure aggr8 is
type Byte is mod 2 ** 8;
subtype two is integer range 1..2;
-- type Sequence is array (1 .. 2) of Byte;
type Sequence is array (Two) of Byte;
type Block is record
Head : Sequence := (11, 22);
end record;
procedure Nest is
Blk : Bloc... | Ada | aggr8.adb |
-- { dg-do compile }
-- { dg-options "-O" }
package body Aggr9 is
procedure Proc (X : R1) is
M : R2 := (F => X);
begin
Send (M);
end;
end Aggr9;
| Ada | aggr9.adb |
with Aggr9_Pkg; use Aggr9_Pkg;
package Aggr9 is
procedure Proc (X : R1);
end Aggr9;
| Ada | aggr9.ads |
package Aggr9_Pkg is
type Byte is range 0 .. 255;
type R1 is
record
A,B : Byte;
end record;
type R2 is
record
F : R1;
end record;
procedure Send (M : R2);
end Aggr9_Pkg;
| Ada | aggr9_pkg.ads |
-- Copyright 2018-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | aggregates.adb |
-- Copyright 2018-2023 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- ... | Ada | aggregates.ads |
-- { dg-do compile }
-- { dg-options "-gnatX" }
procedure AI12_0086_Example is
type Enum is (Aa, Bb, Cc, Dd, Ee, Ff, Gg, Hh, Ii, Jj, Kk, Ll, MM,
Nn, Oo, Pp, Qq, Rr, Ss, Tt, Uu, Vv, Ww, Xx, Yy, Zz);
subtype S is Enum range Dd .. Hh;
type Rec (D : Enum) is record
case D is
... | Ada | ai12_0086_example.adb |
-- { dg-do compile }
with Ada.Finalization; use Ada;
package ai_116 is
pragma Preelaborate;
type Buffer_Type is limited interface;
type Handle is new Finalization.Limited_Controlled and Buffer_Type with
private;
pragma Preelaborable_Initialization(Handle);
type Ptr is access all String;
Null_... | Ada | ai_116.ads |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | ali-util.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | ali-util.ads |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | ali.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | ali.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
procedure aliased1 is
type E is (One, Two);
type R (D : E := One) is record
case D is
when One =>
I1 : Integer;
I2 : Integer;
when Two =>
B1 : Boolean;
end case;
end record;
type Data_Type is record
D... | Ada | aliased1.adb |
-- { dg-do run }
procedure Aliased2 is
type Rec is record
Data : access constant String;
end record;
function Get (S : aliased String) return Rec is
R : Rec := (Data => S'Unchecked_Access);
begin
return R;
end;
S : aliased String := "Hello";
R : Rec := Get (S);
begin
if R.Data'Length /... | Ada | aliased2.adb |
-- { dg-do run }
with Tagged_Type_Pkg; use Tagged_Type_Pkg;
with Ada.Text_IO; use Ada.Text_IO;
procedure Aliased_Prefix_Accessibility is
T_Obj : aliased TT;
T_Obj_Acc : access TT'Class := T_Obj'Access;
type Nested_TT is limited record
TT_Comp : aliased TT;
end record;
... | Ada | aliased_prefix_accessibility.adb |
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -fdump-tree-optimized" }
-- The raise statement must be optimized away by
-- virtue of DECL_NONADDRESSABLE_P set on R.I.
package body Aliasing1 is
function F (P : Ptr) return Integer is
begin
R.I := 0;
P.all := 1;
if R.I /= 0 then
raise Program_E... | Ada | aliasing1.adb |
package Aliasing1 is
type Rec is record
I : Integer;
end record;
type Ptr is access all Integer;
R : Rec;
function F (P : Ptr) return Integer;
end Aliasing1;
| Ada | aliasing1.ads |
-- { dg-do compile }
-- { dg-options "-O2 -gnatp -fdump-tree-optimized" }
-- The raise statement must be optimized away by
-- virtue of TYPE_NONALIASED_COMPONENT set on A.
package body Aliasing2 is
function F (P : Ptr) return Integer is
begin
A (1) := 0;
P.all := 1;
if A(1) /= 0 then
raise Prog... | Ada | aliasing2.adb |
package Aliasing2 is
type Arr is Array (1..4) of Integer;
type Ptr is access all Integer;
A : Arr;
function F (P : Ptr) return Integer;
end Aliasing2;
| Ada | aliasing2.ads |
-- { dg-do run }
-- { dg-options "-O2 -gnatn" }
with Aliasing3_Pkg; use Aliasing3_Pkg;
procedure Aliasing3 is
begin
Pointer.A(1) := 5;
Test (Block.A);
end;
| Ada | aliasing3.adb |
package body Aliasing3_Pkg is
procedure Test (A : Arr) is
begin
if A(1) /= 5 then
raise Program_Error;
end if;
end;
end Aliasing3_Pkg;
| Ada | aliasing3_pkg.adb |
package Aliasing3_Pkg is
type Arr is array (1..3) of Integer;
procedure Test (A : Arr);
pragma Inline (Test);
type My_Arr is new Arr;
type Rec is record
A : My_Arr;
end record;
type Ptr is access all Rec;
Block : aliased Rec;
Pointer : Ptr := Block'Access;
end Aliasing3_Pkg;
| Ada | aliasing3_pkg.ads |
-- { dg-do run }
with System;
procedure align_check is
N_Allocated_Buffers : Natural := 0;
--
function New_Buffer (N_Bytes : Natural) return System.Address is
begin
N_Allocated_Buffers := N_Allocated_Buffers + 1;
return System.Null_Address;
end;
--
Buffer_Address : consta... | Ada | align_check.adb |
-- { dg-do run }
with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Deallocation;
procedure Align_MAX is
Align : constant := Standard'Maximum_Alignment;
generic
type Data_Type (<>) is private;
type Access_Type is access Data_Type;
with function Allocate return Acc... | Ada | align_max.adb |
-- { dg-do run }
procedure Aligned_Vla is
type Table is array (Integer range <>) of Integer;
for Table'Alignment use Long_Float'Alignment;
K : constant := 1;
Konstants : Table (1 .. 4) := (others => K);
procedure Check_Copy (Len : Integer) is
My_Konstants : Table (1 .. Len) := Konstants (1 .. ... | Ada | aligned_vla.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure alignment1 is
type My_Integer is record
Element : Integer;
end record;
F : My_Integer;
begin
if F'Alignment /= F.Element'Alignment then
raise Program_Error;
end if;
end;
| Ada | alignment1.adb |
-- { dg-do compile }
package Alignment1 is
S : Natural := 20;
pragma Volatile (S);
type Block is array (1 .. S) of Integer;
for Block'Alignment use 128;
B : Block;
end;
| Ada | alignment1.ads |
-- { dg-do run }
procedure Alignment10 is
type Short_T is mod 2 ** 16;
for Short_T'Size use 16;
for Short_T'Alignment use 1;
subtype Short_Sub_T is Short_T range 1000 .. 1005;
A : aliased Short_T := 1000;
B : Short_Sub_T;
for B'Address use A'Address;
pragma Import (Ada, B);
b... | Ada | alignment10.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Alignment11 is
type Arr is array (1 .. 3) of Character;
for Arr'Alignment use 4;
A : Arr;
begin
if A'Size /= 32 then
raise Program_Error;
end if;
end;
| Ada | alignment11.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Alignment12 is
type Rec is record
I : Integer;
end record;
R : Rec;
for R'Alignment use 8;
begin
if R'Size /= 32 then
raise Program_Error;
end if;
end;
| Ada | alignment12.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Alignment13 is
type Rec is record
I1 : aliased Short_Integer;
I2 : Integer;
end record;
for Rec use record
I1 at 0 range 0 .. 15;
end record;
R : Rec;
begin
if R.I2'Bit_Position /= 32 then
raise Program_Error;
end if;
end;
| Ada | alignment13.adb |
-- { dg-do compile }
procedure Alignment14 is
type My_Int1 is new Integer;
for My_Int1'Alignment use 8;
type Arr1 is array (1 .. 2) of My_Int1;
type My_Int2 is new Integer;
for My_Int2'Alignment use 16;
type Arr2 is array (1 .. 2) of My_Int2;
begin
null;
end Alignment14;
| Ada | alignment14.adb |
-- { dg-compile }
procedure Alignment15 is
type T0 is record
X : Integer;
end record;
for T0'Alignment use 0;
type T00 is record
X : Integer;
end record with Alignment => 0;
Dummy0 : T0;
Dummy00 : T00;
begin
null;
end;
| Ada | alignment15.adb |
-- { dg-do run }
procedure alignment2 is
pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
MAX_LIST_SIZE : constant INTEGER := 128*16;
LEVEL2_SIZE : constant INTEGER := 128;
LEVEL1_SIZE : constant INTEGER
:= (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
... | Ada | alignment2.adb |
-- { dg-do compile }
with Interfaces; use Interfaces;
package Alignment2 is
pragma Warnings (Off, "*size*");
-- warning
type R1 is record
A, B, C, D : Integer_8;
end record;
for R1'Size use 32;
for R1'Alignment use 32; -- { dg-warning "suspiciously large alignment" }
-- warning
type R2 is recor... | Ada | alignment2.ads |
-- { dg-do compile }
with System, Ada.Unchecked_Conversion;
procedure alignment3 is
type Value_Type (Is_Short : Boolean) is record
case Is_Short is
when True => V : Natural;
when others => A, B : Natural;
end case;
end record;
type Link_Type (Short_Values : Boolean) is rec... | Ada | alignment3.adb |
-- { dg-do compile }
-- { dg-options "-gnatws -fdump-tree-gimple" }
procedure Alignment4 is
type Stream is array (1..3) of Character;
S1, S2 : Stream;
begin
S1 := S2;
end;
-- { dg-final { scan-tree-dump-not ".\F" "gimple" } }
| Ada | alignment4.adb |
-- { dg-do compile }
-- { dg-options "-gnatws -fdump-tree-gimple" }
procedure Alignment5 is
type MY_REC is
record
A1 : INTEGER range -3 .. 3 ; -- symmetric
A2 : BOOLEAN ;
A3 : INTEGER range 0 .. 15 ; -- positive
A4 : INTEGER range 10 .. 100 ; -- arbitrary
A5 : BOOLEAN ; --5... | Ada | alignment5.adb |
-- { dg-do compile }
-- { dg-options "-gnatws -fdump-tree-gimple" }
procedure Alignment6 is
type MY_REC is
record
A1 : INTEGER range -3 .. 3 ; -- symmetric
A2 : BOOLEAN ;
A3 : INTEGER range 0 .. 15 ; -- positive
A4 : INTEGER range 10 .. 100 ; -- arbitrary
A5 : BOOLEAN ; --5... | Ada | alignment6.adb |
-- { dg-do run }
with System;
procedure Alignment7 is
type R is record
I : Integer;
F : Long_Float;
end record;
for R'Alignment use 8;
procedure Q (A : System.Address) is
F : Long_Float;
for F'Address use A;
begin
F := 0.0;
end;
V : R;
begin
Q (V.F'Address);
end;
| Ada | alignment7.adb |
-- { dg-do run }
with System;
procedure Alignment8 is
type R is record
I : Integer;
F : Long_Long_Integer;
end record;
for R'Alignment use 8;
procedure Q (A : System.Address) is
F : Long_Long_Integer;
for F'Address use A;
begin
F := 0;
end;
V : R;
begin
Q (V.F'Address);
end;
| Ada | alignment8.adb |
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Alignment9 is
type Kind is (Small, Large);
for Kind'Size use 8;
type Header is
record
K : Kind;
I : Integer;
end record;
for Header use
record
K at 4 range 0..7;
I at 0 range 0..31;
end record;
for Header'Size ... | Ada | alignment9.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | alloc.ads |
-- { dg-do compile }
procedure Allocator is
type Object_Type is not null access all Integer;
type Object_Array is array (Positive range <>) of Object_Type;
type Object_Array_Ptr is access Object_Array;
type Data_Ptr is access Object_Array_Ptr;
Copy : Data_Ptr := new Object_Array_Ptr;
b... | Ada | allocator.adb |
-- { dg-do compile }
-- { dg-options "-gnatd.F" }
package body Allocator2 is
procedure Dummy is null;
end Allocator2;
| Ada | allocator2.adb |
pragma SPARK_Mode;
package Allocator2 is
type Nat_Array is array (Positive range <>) of Natural with
Default_Component_Value => 0;
type Nat_Stack (Max : Natural) is record
Content : Nat_Array (1 .. Max);
end record;
type Stack_Acc is access Nat_Stack;
type My_Rec is private;
private
... | Ada | allocator2.ads |
-- { dg-do run }
with System.Storage_Elements; use System.Storage_Elements;
with Ada.Unchecked_Deallocation;
procedure Allocator_Maxalign1 is
Max_Alignment : constant := Standard'Maximum_Alignment;
type Block is record
X : Integer;
end record;
for Block'Alignment use Standard'Maximum_Alignment;
... | Ada | allocator_maxalign1.adb |
with System, System.Storage_Elements;
use System.Storage_Elements;
package body Allocator_Maxalign2 is
Max_Align : constant Storage_Offset := Standard'Maximum_Alignment;
procedure Validate is
use type System.Address;
begin
if Addr mod Max_Align /= 0 then
raise Program_Error;
end i... | Ada | allocator_maxalign2.adb |
with System;
package Allocator_Maxalign2 is
type Block is record
X : Integer;
end record;
for Block'Alignment use Standard'Maximum_Alignment;
Addr : System.Address;
procedure Check;
end;
| Ada | allocator_maxalign2.ads |
-- { dg-do compile }
package body Ancestor_Type is
package body B is
function make return T is
begin
return (T with n => 0); -- { dg-error "expect ancestor" }
end make;
end B;
end Ancestor_Type;
| Ada | ancestor_type.adb |
package Ancestor_Type is
type T is tagged private;
package B is
function make return T;
end B;
private
type T is tagged record
n: Natural;
end record;
end Ancestor_Type;
| Ada | ancestor_type.ads |
-- { dg-do compile }
procedure Annotation1 is
pragma Annotate (Some_Tool, Some_Action, "abc" & "def");
begin
null;
end Annotation1; | Ada | annotation1.adb |
package anon1 is
function F return access Integer;
end anon1;
| Ada | anon1.ads |
-- { dg-do compile }
with anon1;
procedure anon2 is
begin
if anon1.F /= null then
null;
end if;
end anon2;
| Ada | anon2.adb |
-- { dg-do compile }
-- { dg-options "-gnatwa" }
package body Anon3 is
procedure Dummy is null;
end Anon3;
| Ada | anon3.adb |
package Anon3 is
X : access Integer := new Integer;
procedure Dummy;
end Anon3;
| Ada | anon3.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
package body array1 is
subtype Small is Integer range 1 .. MAX;
type LFT is record
RIC_ID : RIC_TYPE;
end record;
LF : array (RIC_TYPE, Small) of LFT;
procedure Foo (R : RIC_TYPE) is
L : Small;
T : LFT renames LF (R, L);
begin
S... | Ada | array1.adb |
-- { dg-do compile }
pragma Restrictions (No_Elaboration_Code);
package Array1 is
type Arr is array (Positive range <>) of Boolean;
A : Arr (1 .. 2 ** 29);
end Array1;
| Ada | array1.ads |
-- { dg-do run }
-- Verify that an array of non-aliased zero-sized element is zero-sized
procedure Array10 is
type Rec is null record;
type Arr1 is array (1..8) of Rec;
type Arr2 is array (Long_Integer) of Rec;
R : Rec;
A1 : Arr1;
A2 : Arr2;
begin
if Rec'Size /= 0 then
raise Program_Error;
end ... | Ada | array10.adb |
-- { dg-do compile }
with System;
procedure Array11 is
type Rec is null record;
type Index_T is mod System.Memory_Size;
type Arr1 is array (1 .. 8) of aliased Rec; -- { dg-warning "padded" }
type Arr2 is array (Index_T) of aliased Rec; -- { dg-warning "padded" }
A1 : Arr1;
A2 : Arr2;
begin
null;
end... | Ada | array11.adb |
-- { dg-do run }
procedure Array12 is
function N return Integer is
begin
return 0;
end;
subtype Element is String (1 .. N);
type Ptr is access all Element;
type Vector is array (Positive range <>) of aliased Element;
V : Vector (1..2);
begin
if Ptr'(V(1)'Access) = V(2)'Access then
raise Pro... | Ada | array12.adb |
null | null | null |
package Array13 is
Max : Natural := 1;
type Arr is array (Natural range 0..Max) of Natural;
type T is record
A : Arr := (others => 0);
end record;
procedure Foo;
end Array13;
| Ada | array13.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
with Array14_Pkg; use Array14_Pkg;
package body Array14 is
package Nested is
Length : constant SSE.Storage_Count := Length2;
subtype Encoded_Index_Type is SSE.Storage_Count range 1 .. Length;
subtype Encoded_Type is SSE.Storage_Array (Encoded_Index_Typ... | Ada | array14.adb |
package Array14 is
procedure Init;
end Array14;
| Ada | array14.ads |
with System.Storage_Elements;
package Array14_Pkg is
package SSE renames System.Storage_Elements;
function Parity_Byte_Count return SSE.Storage_Count;
Length2 : constant SSE.Storage_Count := Parity_Byte_Count;
subtype Encoded_Index_Type2 is SSE.Storage_Count range 1 .. Length2;
subtype Encoded_Type2 is S... | Ada | array14_pkg.ads |
-- { dg-do compile }
-- { dg-options "-O -gnatws" }
package body Array15 is
type Arr is array (Natural range <>) of Integer;
Table : Arr (1 .. 4);
N : Natural := 1;
procedure Zero is
begin
N := 0;
end;
function F (I : Integer) return Integer is
A1 : Arr := (1 => I);
A2 : Arr... | Ada | array15.adb |
package Array15 is
function F (I : Integer) return Integer;
end Array15;
| Ada | array15.ads |
-- { dg-do compile }
-- { dg-options "-O -gnatn -fdump-tree-optimized" }
package body Array16 is
function F1 (A : access My_T1) return My_T1 is
begin
return A.all;
end;
function F2 (A : access My_T2) return My_T2 is
begin
return A.all;
end;
procedure Proc (A : access My_T1; B : access My_T2) i... | Ada | array16.adb |
with Array16_Pkg;
package Array16 is
type T1 (D : Integer) is record
case D is
when 1 => I : Integer;
when others => null;
end case;
end record;
type Arr is array (Integer range <>) of Integer;
type My_T1 is new T1 (Array16_Pkg.N);
type My_T2 is new Arr (1 .. Integer'Min (2, Array16_Pk... | Ada | array16.ads |
package Array16_Pkg is
function N return Integer;
end Array16_Pkg;
| Ada | array16_pkg.ads |
-- { dg-do compile }
with Array17_Pkg; use Array17_Pkg;
procedure Array17 is
X : aliased Varray := (1 .. 8 => 1.0);
Y : Varray (1 .. 8) := (others => -1.0);
R : Varray (1 .. 8);
begin
R (1 .. 4) := Y (1 .. 4) + X (1 .. 4);
end;
| Ada | array17.adb |
package Array17_Pkg is
type Varray is array (Integer range <>) of Long_Float;
for Varray'Alignment use 16;
function "+" (X, Y : Varray) return Varray;
end Array17_Pkg;
| Ada | array17_pkg.ads |
-- { dg-do compile }
with Array18_Pkg; use Array18_Pkg;
procedure Array18 is
A : String (1 .. 1);
begin
A := F;
end;
| Ada | array18.adb |
package Array18_Pkg is
function N return Positive;
subtype S is String (1 .. N);
function F return S;
end Array18_Pkg;
| Ada | array18_pkg.ads |
-- { dg-do compile }
package body Array19 is
function N return Integer is
begin
return 1;
end;
type Array_Type is array (1 .. N) of Float;
type Enum is (One, Two);
type Rec (D : Enum := Enum'First) is record
case D is
when One => null;
when Two => A : Array_Type;
... | Ada | array19.adb |
package Array19 is
procedure Proc;
end Array19;
| Ada | array19.ads |
with SYSTEM;
WITH array2; use array2;
package array1 is
procedure Foo (R : RIC_TYPE);
procedure Start_Timer (Q : SYSTEM.ADDRESS);
end array1;
| Ada | array1_1.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
pragma Restrictions (No_Elaboration_Code);
package Array2 is
type Arr is array (Positive range <>) of Boolean;
A : Arr (1 .. 2 ** 2);
for A'Size use 16#1000_0000_0#;
end Array2;
| Ada | array2.ads |
-- { dg-do assemble }
package body Array20 is
type Arr is array (Positive range <>) of Integer;
type P_Arr is access Arr;
N : constant P_Arr := null;
Table : P_Arr := N;
end Array20;
| Ada | array20.adb |
package Array20 is
pragma Elaborate_Body;
end array20;
| Ada | array20.ads |
-- { dg-do run }
with System;
procedure Array21 is
type Index_T is mod System.Memory_Size;
type Arr
is array (Index_T range Index_T'Last/2-3 .. Index_T'Last/2+3) of Integer;
C : constant Arr := (1, others => 2);
begin
if C /= (1, 2, 2, 2, 2, 2, 2) then
raise Program_Error;
end if;
end;
| Ada | array21.adb |
-- { dg-do compile }
with System; use System;
procedure Array22 is
type Integer_Address is mod Memory_Size;
type Memory is array (Integer_Address range <>) of Character;
type Chunk (First, Last : Integer_Address) is record
Mem : Memory (First .. Last);
end record;
C : Chunk (1, 8);
for C'A... | Ada | array22.adb |
-- { dg-do link }
with Array23_Pkg1;
with Array23_Pkg2;
procedure Array23 is
A : Array23_Pkg1.Arr;
begin
A(Array23_Pkg2.One)(1) := 0;
end;
| Ada | array23.adb |
with Array23_Pkg2;
package Array23_Pkg1 is
C2 : Natural := Array23_Pkg2.C1;
subtype Index is Natural range 0 .. C2;
type Inner is array (Index) of Natural;
type Arr is array (Array23_Pkg2.Index) of Inner;
end Array23_Pkg1;
| Ada | array23_pkg1.ads |
with Array23_Pkg3;
package Array23_Pkg2 is
C1 : Natural := Array23_Pkg3.C0;
type Enum is (Zero, One, Two);
subtype Index is Enum range One .. Enum'val(C1);
end Array23_Pkg2;
| Ada | array23_pkg2.ads |
package Array23_Pkg3 is
C0 : Natural := 2;
end Array23_Pkg3;
| Ada | array23_pkg3.ads |
-- { dg-do compile }
-- { dg-options "-fdump-tree-optimized" }
procedure Array24 (N : Natural) is
S : String (1 .. N);
pragma Volatile (S);
begin
S := (others => '0');
end;
-- { dg-final { scan-tree-dump-not "builtin_unwind_resume" "optimized" } }
| Ada | array24.adb |
-- { dg-do compile }
with Array25_Pkg;
procedure Array25 is
package My_Pkg is new Array25_Pkg (0, 0);
begin
null;
end;
| Ada | array25.adb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.