file_text stringlengths 1 2.1M ⌀ | language stringclasses 416
values | file_name stringlengths 1 185 ⌀ |
|---|---|---|
package body Array25_Pkg is
procedure Get_Inner (A : out Arr1) is
begin
null;
end;
procedure Get (A : out Arr2) is
begin
for I in Arr2'Range loop
Get_Inner (A (I).Data);
end loop;
end;
end Array25_Pkg;
| Ada | array25_pkg.adb |
generic
UB1 : Natural;
UB2 : Natural;
package Array25_Pkg is
type Arr1 is array (1 .. UB1) of Integer;
type Rec is record
Data : Arr1;
end record;
type Arr2 is array (1 .. UB2) of Rec;
procedure Get (A : out Arr2);
end Array25_Pkg;
| Ada | array25_pkg.ads |
-- { dg-do run }
-- { dg-options "-O" }
with Array26_Pkg; use Array26_Pkg;
procedure Array26 is
function Get return Outer_type is
Ret : Outer_Type;
begin
Ret (Inner_Type'Range) := F;
return Ret;
end;
A : Outer_Type := Get;
B : Inner_Type := A (Inner_Type'Range);
begin
if B /= "123" then
... | Ada | array26.adb |
package body Array26_Pkg is
function F return Inner_Type is
begin
return "123";
end;
end Array26_Pkg;
| Ada | array26_pkg.adb |
package Array26_Pkg is
subtype Outer_Type is String (1 .. 4);
subtype Inner_Type is String (1 .. 3);
function F return Inner_Type;
end Array26_Pkg;
| Ada | array26_pkg.ads |
-- { dg-do run }
-- { dg-options "-O" }
with Array27_Pkg; use Array27_Pkg;
procedure Array27 is
function Get return Outer_type is
Ret : Outer_Type;
begin
Ret (Inner_Type'Range) := F;
return Ret;
end;
A : Outer_Type := Get;
B : Inner_Type := A (Inner_Type'Range);
begin
if B /= "123" then
... | Ada | array27.adb |
package body Array27_Pkg is
function F return Inner_Type is
begin
return "123";
end;
end Array27_Pkg;
| Ada | array27_pkg.adb |
package Array27_Pkg is
subtype Outer_Type is String (1 .. 8);
subtype Inner_Type is String (1 .. 3);
function F return Inner_Type;
end Array27_Pkg;
| Ada | array27_pkg.ads |
-- { dg-do run }
-- { dg-options "-O" }
with Array28_Pkg; use Array28_Pkg;
procedure Array28 is
function Get return Outer_type is
Ret : Outer_Type;
begin
Ret (Inner_Type'Range) := F;
return Ret;
end;
A : Outer_Type := Get;
B : Inner_Type := A (Inner_Type'Range);
begin
if B /= "12345" then
... | Ada | array28.adb |
package body Array28_Pkg is
function F return Inner_Type is
begin
return "12345";
end;
end Array28_Pkg;
| Ada | array28_pkg.adb |
package Array28_Pkg is
subtype Outer_Type is String (1 .. 8);
subtype Inner_Type is String (1 .. 5);
function F return Inner_Type;
end Array28_Pkg;
| Ada | array28_pkg.ads |
-- { dg-do compile }
-- { dg-options "-O" }
package body Array29 is
procedure Copy (Src : in Matrix; Dst : out Matrix) is
begin
for I in Src'Range (1) loop
for J in Src'Range (2) loop
Dst (I, J) := Src (I, J);
end loop;
end loop;
end;
procedure Proc is
N : constant := 2;
F... | Ada | array29.adb |
package Array29 is
type Matrix is array (Integer range <>, Integer range <>) of Long_Float;
procedure Proc;
end Array29;
| Ada | array29.ads |
package array2 is
type RIC_TYPE is (RIC1, RIC2);
for RIC_TYPE'SIZE use 32;
function MAX return Integer;
end array2;
| Ada | array2_1.ads |
-- { dg-do run }
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
procedure array3 is
type Method_Kinds is (Signal, Slot, Method);
package Unbounded_String_Vectors is
new Ada.Containers.Vectors
(Positive, Ada.Strings.Unbounded.Unbounded_String);
Param... | Ada | array3.adb |
-- PR middle-end/56474
-- Reported by Pavel Zhukov <pavel@zhukoff.net>
-- { dg-do compile }
with Ada.Streams;
package Array3 is
use type Ada.Streams.Stream_Element_Offset;
type Vector (Size : Ada.Streams.Stream_Element_Offset) is record
Value : Ada.Streams.Stream_Element_Array (0 .. Size);
end recor... | Ada | array3.ads |
-- { dg-do run }
with Ada.Text_IO;
procedure Array30 is
package P is
type T is tagged record
value : Integer := 123;
end record;
type Ar is array (1..10) of T;
function F (Obj : T) return Ar;
function F2 (Obj : T) return T;
end P;
use P;
package body P is
f... | Ada | array30.adb |
-- { dg-do run }
procedure Array31 is
type Boolean_Access is access Boolean;
type Boolean_Access_Array is
array (Positive range <>) of not null Boolean_Access;
X : constant Boolean_Access_Array := (1 => new Boolean'(False));
Y : constant Boolean_Access_Array := X & X;
begin
null;
end;
| Ada | array31.adb |
-- { dg-do compile }
package body Array32 is
procedure Init (A : out Arr) is
begin
A := ((I => 1), (I => 2));
end;
end Array32;
| Ada | array32.adb |
package Array32 is
type Rec is record
I : Integer;
end record;
type Arr is array (Positive range <>) of Rec;
procedure Init (A : out Arr);
end Array32;
| Ada | array32.ads |
-- { dg-do run }
procedure Array33 is
generic
type Item_T is private; -- The type of which the interval is made of.
type Bound_T is private;
None_Bound : Bound_T;
Bounds_Are_Static : Boolean := False;
type Value_T is private;
type Base_Index_T is range <>;
package General_Interval_Partitio... | Ada | array33.adb |
-- { dg-do run }
procedure Array34 is
type Arr is array (1 .. 6) of Short_Short_Integer;
for Arr'Alignment use 4;
type Rec is record
A : Arr;
B: Short_Integer;
end record;
pragma Pack (Rec);
R : Rec;
begin
R.B := 31415;
R.A := (others => 0);
if R.B /= 31415 then
raise Program_Error;
... | Ada | array34.adb |
-- { dg-do run }
procedure Array35 is
subtype Str is String (1 .. 3);
type T is record
B : Boolean;
S : Str;
end record;
for T use record
B at 0 range 0 .. 0;
S at 0 range 1 .. 24;
end record;
X : T := (B => True, S => "123");
begin
X.B := False;
if X.S /= "123" th... | Ada | array35.adb |
-- { dg-do run }
procedure Array36 is
subtype Str is String (1 .. 3);
type Rec is record
S : Str;
end record;
type T is record
B : Boolean;
R : Rec;
end record;
for T use record
B at 0 range 0 .. 0;
R at 0 range 1 .. 24;
end record;
X : T := (B => True, R => ... | Ada | array36.adb |
-- { dg-do run }
-- { dg-options "-O" }
procedure Array37 is
type Arr is array (Integer range -1 .. 1) of Integer;
A : Arr := (-100, 0, 100);
function Ident (I : Integer) return Integer IS
begin
return I;
end;
begin
if Ident (A (1)) <= Ident (A (0)) then
raise Program_Error;
end if;
end;
| Ada | array37.adb |
-- { dg-do compile }
with Array38_Pkg; use Array38_Pkg;
procedure Array38 is
function My_F is new F (Index, Byte, Bytes, Integer);
begin
null;
end;
| Ada | array38.adb |
package body Array38_Pkg is
function F (Data : Array_Type) return Value_Type is
begin
return Value_Type'First;
end;
end Array38_Pkg;
| Ada | array38_pkg.adb |
package Array38_Pkg is
type Byte is mod 2**8;
type Length is new Natural;
subtype Index is Length range 1 .. Length'Last;
type Bytes is array (Index range <>) of Byte with
Predicate => Bytes'Length > 0;
generic
type Index_Type is (<>);
type Element_Type is (<>);
type Array_Ty... | Ada | array38_pkg.ads |
-- { dg-do run }
with Array39_Pkg; use Array39_Pkg;
procedure Array39 is
T : Tsk;
R : Rec2;
begin
T.E (R, 1);
if R.A (1) /= Val then
raise Program_Error;
end if;
end;
| Ada | array39.adb |
package body Array39_Pkg is
task Body Tsk is
begin
select
accept E (R : out Rec2; L : Index2) do
declare
A : Arr2 (Index2);
LL : Index2 := L;
begin
for I in 1 .. LL loop
A (I) := Val;
end loop;
R := (D => LL, A => A (1 .. LL));
end;
... | Ada | array39_pkg.adb |
package Array39_Pkg is
subtype Index1 is Natural range 0 .. 2;
type Arr1 is array (Index1 range <>) of Integer;
type Rec1 (D : Index1 := 0) is record
A : Arr1 (1 .. D);
end record;
subtype Index2 is Natural range 0 .. 7;
type Arr2 is array (Index2 range <>) of Rec1;
type Rec2 (D : Index2 := 0) i... | Ada | array39_pkg.ads |
-- { dg-do run }
procedure Array4 is
type A is array (1..5) of Integer;
f : constant A := (1, 2, 3, 4, 5);
i1 : integer renames f(1);
i2 : integer renames f(2);
i3 : integer renames f(3);
i4 : integer renames f(4);
i5 : integer renames f(5);
procedure Link_Failure;
pragma Import (C, Link_... | Ada | array4.adb |
-- { dg-do compile }
-- { dg-skip-if "missing -gsplit-dwarf support" { *-*-darwin* } }
-- { dg-options "-gsplit-dwarf" }
package Array4 is
type Arr1 is array (Positive range <>) of Boolean;
Size : Positive := 20;
type Rec is record
A : Arr1 (1 .. Size);
end record;
type Arr2 is array (Positive range ... | Ada | array4.ads |
-- { dg-do run }
-- { dg-options "-gnatws" }
with System.Storage_Elements;
with Array40_Pkg; use Array40_Pkg;
procedure Array40 is
use System;
use System.Storage_Elements;
begin
if A(1)'Size /= 40 then
raise Program_Error;
end if;
if (A(2)'Address - A(1)'Address) * System.Storage_Unit /= 40 then
... | Ada | array40.adb |
package Array40_Pkg is
type Rec is record
I : Integer;
end record;
type Arr is array (1 .. 4) of Rec;
for Arr'Component_Size use 40;
A : Arr;
end Array40_Pkg;
| Ada | array40_pkg.ads |
-- { dg-do run }
-- { dg-options "-O" }
procedure Array5 is
type myint is range 0 .. 100_000;
Bla : constant myint := 359;
type my_array is array (1 .. 2) of myint;
type item is record
Length : Integer;
Content : my_array;
end record;
procedure create_item (M : out item) is
... | Ada | array5.adb |
-- { dg-do compile }
with Array5_Pkg1; use Array5_Pkg1;
package Array5 is
C : constant Integer := Arr'Last;
end Array5;
| Ada | array5.ads |
with Array5_Pkg2; use Array5_Pkg2;
with Array5_Pkg2.G;
package Array5_Pkg1 is
type Derived is new Root with record
N : Integer;
end record;
package My_G is new Array5_Pkg2.G (Derived);
type Arr is array (1 .. My_G.Data.N) of Integer;
end Array5_Pkg1;
| Ada | array5_pkg1.ads |
with System.Address_To_Access_Conversions;
generic
type T is new Root with private;
package Array5_Pkg2.G is
package Ptr is new System.Address_To_Access_Conversions (T);
Data : Ptr.Object_Pointer;
end Array5_Pkg2.G;
| Ada | array5_pkg2-g.ads |
package Array5_Pkg2 is
type Root is tagged null record;
end Array5_Pkg2;
| Ada | array5_pkg2.ads |
-- { dg-do run }
with Interfaces; use Interfaces;
procedure Array6 is
type buf_t is array (unsigned_32 range <>) of character;
type v_str_t (first, last : unsigned_32) is
record
buf : buf_t (first .. last) := (others => ' ');
end record;
type v_str_ptr_t is access all v_str_t;
v_str... | Ada | array6.adb |
-- { dg-do compile }
-- { dg-options "-O -gnatp -fdump-tree-optimized" }
package body Array7 is
package body Range_Subtype is
function Get_Arr (Nbr : My_Range) return Arr_Acc is
begin
return new Arr (1 .. Nbr);
end;
end;
package body Range_Type is
function Get_Arr (Nbr : My_... | Ada | array7.adb |
package Array7 is
package Range_Subtype is
type Arr is array (Positive range <>) of Integer;
type Arr_Acc is access Arr;
subtype My_Range is Integer range 1 .. 25;
function Get_Arr (Nbr : My_Range) return Arr_Acc;
end;
package Range_Type is
type My_Range is range 1 .. 25;
... | Ada | array7.ads |
-- { dg-do compile }
-- { dg-options "-O2" }
PROCEDURE Array8 IS
function ID (I : Integer) return Integer is
begin
return I;
end;
SUBTYPE STB IS INTEGER RANGE ID(-8) .. -5;
TYPE TB IS ARRAY (STB RANGE <>) OF INTEGER;
GENERIC
B1 : TB;
PROCEDURE PROC1;
PROCEDURE PROC1 IS
BEGIN
IF B1'FI... | Ada | array8.adb |
-- { dg-do run }
procedure Array9 is
V1 : String(1..10) := "1234567890";
V2 : String(1..-1) := "";
procedure Compare (S : String) is
begin
if S'Size /= 8*S'Length then
raise Program_Error;
end if;
end;
begin
Compare ("");
Compare ("1234");
Compare (V1);
Compare (V2);
end;
| Ada | array9.adb |
-- { dg-do run }
with Ada.Streams; use Ada.Streams;
procedure Array_Bounds_Test is
One : constant Stream_Element := 1;
Two : constant Stream_Element := 2;
Sample : constant Stream_Element_Array := (0 => One) & Two;
begin
if Sample'First /= 0 then
raise Program_Error;
end if;
if Sample... | Ada | array_bounds_test.adb |
-- { dg-do run }
with Ada.Unchecked_Deallocation;
procedure Array_Bounds_Test2 is
type String_Ptr_T is access String;
procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr_T);
String_Data : String_Ptr_T := new String'("Hello World");
function Peek return String_Ptr_T is
begin
return St... | Ada | array_bounds_test2.adb |
-- Copyright 2015-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 | array_list_g.ads |
-- { dg-do compile }
pragma Restrictions (No_Default_Initialization);
package Array_No_Def_Init is
type Int_Array is array (Natural range <>) of Integer;
IA : Int_Array (1 .. 10);
end Array_No_Def_Init;
| Ada | array_no_def_init.ads |
-- { dg-do compile }
-- { dg-additional-sources asan1_pkg.ads }
-- { dg-options "-fsanitize=address" }
-- { dg-skip-if "no address sanitizer" { no_fsanitize_address } }
with Asan1_Pkg;
procedure Asan1 is
use Asan1_Pkg;
X, Y : E;
begin
X := C (N);
Y := V;
end Asan1;
| Ada | asan1.adb |
package Asan1_Pkg is
subtype E is Integer;
type T is array (1..32) of E;
function N return T;
function C (P : T) return E;
V : constant E := C (N);
end Asan1_Pkg;
| Ada | asan1_pkg.ads |
-- { dg-do compile }
with Aspect1_Horizontal;
with Aspect1_Vectors_2D;
procedure Aspect1 is
type Speed is new Float;
package Distances is new Aspect1_Vectors_2D (Float);
package Velocities is new Aspect1_Vectors_2D (Speed);
package Motion is new Aspect1_Horizontal (Distances, Velocities);
begin
null;
... | Ada | aspect1.adb |
package body Aspect1_Horizontal is
function Theta_D(s: Position_2d_Pkg.Vect2; nzv: Speed_2d_Pkg.Nz_vect2)
return float
is
a: constant float := 0.0;
begin
return 0.0;
end Theta_D;
end Aspect1_Horizontal;
| Ada | aspect1_horizontal.adb |
with Aspect1_Vectors_2D;
generic
with package Position_2d_Pkg is new Aspect1_Vectors_2D (<>);
with package Speed_2d_Pkg is new Aspect1_Vectors_2D (<>);
package Aspect1_Horizontal is
function Theta_D(s: Position_2d_Pkg.Vect2; nzv: Speed_2d_Pkg.Nz_vect2)
return float;
end Aspect1_Horizontal;
| Ada | aspect1_horizontal.ads |
generic
type T_horizontal is new float;
-- Declaration of types, constants, and common functions on 3D vectors.
-- Corresponds to PVS theory vectors/vectors_2D
package Aspect1_Vectors_2D is
-- A 2D vector, represented by an x and a y coordinate.
type Vect2 is record
x: T_horizontal;
y: T_horizont... | Ada | aspect1_vectors_2d.ads |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | aspects.adb |
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- ... | Ada | aspects.ads |
package Assert is
procedure Assert (Condition : Boolean);
end Assert;
| Ada | assert.ads |
-- { dg-do run }
-- { dg-options "-gnatws" }
pragma Assertion_Policy (Check);
procedure assert1 is
Int128 : constant Boolean := Standard'Max_Integer_Size = 128;
type p1 is array (1 .. 113) of Boolean;
pragma Pack (p1);
type p2 is array (1 .. 13) of Boolean;
pragma Pack (p2);
type p3 is array (1 ..... | Ada | assert1.adb |
-- { dg-do compile }
package body Assert2 is
procedure Dummy is null;
end Assert2;
| Ada | assert2.adb |
package Assert2
with SPARK_Mode
is
type Living is new Integer;
function Is_Martian (Unused : Living) return Boolean is (False);
function Is_Green (Unused : Living) return Boolean is (True);
pragma Assert
(for all M in Living => (if Is_Martian (M) then Is_Green (M)));
pragma Assert
(for al... | Ada | assert2.ads |
-- { dg-do run }
-- { dg-options "-gnata" }
with Ada.Text_IO; use Ada.Text_IO;
with Assertion_Policy1_Pkg; use Assertion_Policy1_Pkg;
procedure Assertion_Policy1 is
begin
Proc (2, 1);
exception
when others =>
Put_Line ("ERROR: unexpected exception");
raise;
end Assertion_Policy1;
| Ada | assertion_policy1.adb |
with Ada.Text_IO; use Ada.Text_IO;
package body Assertion_Policy1_Pkg is
procedure Proc (Low : Integer; High : Integer) is
begin
Put_Line ("Proc");
end Proc;
end Assertion_Policy1_Pkg;
| Ada | assertion_policy1_pkg.adb |
package Assertion_Policy1_Pkg is
pragma Assertion_Policy (Ignore);
procedure Proc (Low : Integer; High : Integer)
with Pre => Low < High;
end Assertion_Policy1_Pkg;
| Ada | assertion_policy1_pkg.ads |
-- Copyright 2008-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 | assign.adb |
-- { dg-do run }
with assign_from_packed_pixels;
use assign_from_packed_pixels;
procedure assign_from_packed is
A : Integer := Minus_One;
Pos : Position;
begin
Pos := Pix.Pos;
if A /= Minus_One then
raise Program_Error;
end if;
end;
| Ada | assign_from_packed.adb |
package Assign_From_Packed_Pixels is
type U16 is mod 2 ** 16;
type Position is record
X, Y, Z : U16;
end record;
for Position'Size use 48;
type Pixel is record
Pos : Position;
end record;
pragma Pack (Pixel);
Minus_One : Integer := -1;
Pix : Pixel := (Pos => (X => 0, Y => 0, ... | Ada | assign_from_packed_pixels.ads |
-- { dg-do compile }
package body asynch is
function null_ctrl return t_ctrl is
begin
return (Ada.Finalization.Controlled with stuff => 0);
end null_ctrl;
procedure Proc (msg : String; c : t_ctrl := null_ctrl) is
begin
null;
end Proc;
task type tsk;
task body tsk is
begi... | Ada | asynch.adb |
with Ada.Finalization;
package asynch is
type t_ctrl is new Ada.Finalization.Controlled with record
stuff : Natural := 0;
end record;
function null_ctrl return t_ctrl;
end asynch;
| Ada | asynch.ads |
-- { dg-do compile }
-- { dg-options "-O0 -fdump-tree-gimple" }
with Atomic1_Pkg; use Atomic1_Pkg;
procedure Atomic1 is
C_16 : constant R16 := (2, 3, 5, 7);
C_32 : constant R32 := (1, 1, 2, 3, 5, 8, 13, 5);
begin
V_16 := C_16;
V_32 := C_32;
end;
-- { dg-final { scan-tree-dump-times "v_16" 1 "gimple"} }... | Ada | atomic1.adb |
-- { dg-do compile }
package Atomic1 is
type Arr is array (Integer range <>) of Boolean;
type UA is access all Arr;
U : UA;
pragma Atomic (U); -- { dg-error "atomic access" "" { xfail mips*-*-* } }
type R is record
U : UA;
pragma Atomic (U); -- { dg-error "atomic access" "" { xfail mips*-*-* } }... | Ada | atomic1.ads |
-- { dg-do compile }
-- { dg-options "-gnatws" }
with System.Multiprocessors;
procedure Atomic10 is
type Atomic_Unsigned is mod 2 ** 32;
pragma Atomic (Atomic_Unsigned);
Max : Positive := Positive (System.Multiprocessors.Number_Of_CPUs);
Comp_Size : constant := 64 * 8;
subtype Index_Type is Positive ran... | Ada | atomic10.adb |
-- { dg-do compile }
with Atomic11_Pkg1; use Atomic11_Pkg1;
procedure Atomic11 is
R1 : Rec1;
pragma Atomic (R1);
R2 : Rec2;
pragma Volatile (R2);
begin
R1.I := 0;
Proc1 (R1); -- { dg-warning "atomic actual passed by copy" }
R2.A(1) := 0;
Proc1 (R1); -- { dg-warning "atomic actual passed by c... | Ada | atomic11.adb |
with Atomic11_Pkg2;
package Atomic11_Pkg1 is
type Rec1 is record
I : Integer;
end record;
procedure Proc1 (R : Rec1);
pragma Import (C, Proc1);
type Arr is array (Positive range <>) of Integer;
type Rec2 is record
A : Arr (1 .. Atomic11_Pkg2.Max);
end record;
procedure Proc2 (R : Rec2);
e... | Ada | atomic11_pkg1.ads |
package Atomic11_Pkg2 is
function Max return Positive;
end Atomic11_Pkg2;
| Ada | atomic11_pkg2.ads |
package Atomic1_Pkg is
type Four_Bits is mod 2 ** 4;
type R16 is record
F1 : Four_Bits;
F2 : Four_Bits;
F3 : Four_Bits;
F4 : Four_Bits;
end record;
for R16 use record
F1 at 0 range 0 .. 3;
F2 at 0 range 4 .. 7;
F3 at 0 range 8 .. 11;
F4 at 0 range 12 ..... | Ada | atomic1_pkg.ads |
-- { dg-do compile }
procedure Atomic2 is
type Big is array (1..4) of Integer;
type Arr is array (1..10) of Big;
pragma Atomic_Components (Arr); -- { dg-warning "cannot be guaranteed" }
begin
null;
end;
| Ada | atomic2.adb |
-- { dg-do compile }
package Atomic2 is
type Rec1 is record
C : Character;
I : Integer;
pragma Atomic (I);
end record;
for Rec1 use record
C at 0 range 0 .. 7;
I at 1 range 0 .. 31; -- { dg-error "position for atomic|alignment" }
end record;
type Rec2 is record
C : Character;
I ... | Ada | atomic2.ads |
-- { dg-do compile }
procedure Atomic3 is
type Unsigned_32_T is mod 2 ** 32;
for Unsigned_32_T'Size use 32;
type Id_T is (One, Two, Three);
type Array_T is array (Id_T) of Unsigned_32_T;
pragma Atomic_Components (Array_T);
A : Array_T := (others => 0);
function Get_Array return Array_T is
... | Ada | atomic3.adb |
-- { dg-do compile }
package Atomic3 is
type Four_Bits is mod 2**4;
type Fourteen_Bits is mod 2**14;
type Twenty_Eight_Bits is mod 2**28;
type Rec1 (Mode : Boolean := True) is record
Reserved : Four_Bits;
case Mode is
when True =>
High_Part : Fourteen_Bits;
Low_... | Ada | atomic3.ads |
-- { dg-do compile }
-- { dg-options "-O -gnatn" }
package body Atomic4 is
procedure Next (Self : in out Reader'Class) is
begin
Self.Current_Reference := Self.Reference_Stack.Last_Element;
Self.Reference_Stack.Delete_Last;
end Next;
end Atomic4;
| Ada | atomic4.adb |
with Ada.Containers.Vectors;
package Atomic4 is
type String is limited null record;
type String_Access is access all String;
pragma Atomic (String_Access);
type Reference is record
Text : String_Access;
end record;
package Reference_Vectors is
new Ada.Containers.Vectors (Natural, Refere... | Ada | atomic4.ads |
-- { dg-do compile }
package body Atomic5 is
function Create return R is
begin
return (A => 0, B => 1, C => 2, D => 4);
end;
procedure Proc1 is
I : Unsigned_32;
begin
I := Conv(Create);
end;
procedure Proc2 is
I : Unsigned_32;
begin
I := Conv(R'(A => 0, B => 1, C => 2, D => 4));
... | Ada | atomic5.adb |
with Unchecked_Conversion;
package Atomic5 is
type Byte is mod 2 ** 8;
for Byte'Size use 8;
type Unsigned_32 is mod 2 ** 32;
for Unsigned_32'Size use 32;
type R is record
A,B,C,D : Byte;
end record;
for R'Alignment use 4;
pragma Atomic (R);
function Conv is new Unchecked_Conversion (R, Unsign... | Ada | atomic5.ads |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_1 is
Temp : Integer;
begin
Counter1 := Counter2;
Timer1 := Timer2;
Counter1 := Int(Timer1);
Timer1 := Integer(Counter1);
Temp := Integer(Counter1);
Counter1 := Int(Temp);
Temp := Timer... | Ada | atomic6_1.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_2 is
Temp : Integer;
begin
Counter1 := Counter1 + Counter2;
Timer1 := Timer1 + Timer2;
Counter1 := Counter1 + Int(Timer1);
Timer1 := Timer1 + Integer(Counter1);
Temp := Integer(Counter1) + ... | Ada | atomic6_2.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_3 is
function F (I : Integer) return Integer is
begin
return I;
end;
function F2 return Integer is
begin
return Integer(Counter1);
end;
function F3 return Integer is
begin
re... | Ada | atomic6_3.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_4 is
procedure P (I1 : out Integer; I2 : in Integer) is
begin
I1 := I2;
end;
Temp : Integer;
begin
P (Integer(Counter1), Integer(Counter2));
P (Timer1, Timer2);
P (Integer(Counter1),... | Ada | atomic6_4.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_5 is
type Arr is array (Integer range 1 .. 4) of Boolean;
A : Arr;
B : Boolean;
begin
A (Integer(Counter1)) := True;
B := A (Timer1);
declare
pragma Suppress (Index_Check);
begin
A ... | Ada | atomic6_5.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_6 is
Temp : Integer;
begin
Counter(1) := Counter(2);
Timer(1) := Timer(2);
Counter(1) := Int(Timer(1));
Timer(1) := Integer(Counter(1));
Temp := Integer(Counter(1));
Counter(1) := Int(Tem... | Ada | atomic6_6.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_7 is
My_Atomic : R;
Temp : Integer;
begin
My_Atomic.Counter1 := Counter2;
My_Atomic.Timer1 := Timer2;
My_Atomic.Counter1 := Int(My_Atomic.Timer1);
My_Atomic.Timer1 := Integer(My_Atomic.Coun... | Ada | atomic6_7.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Atomic6_Pkg; use Atomic6_Pkg;
procedure Atomic6_8 is
Ptr : Int_Ptr := new Int;
Temp : Integer;
begin
Ptr.all := Counter1;
Counter1 := Ptr.all;
Ptr.all := Int(Timer1);
Timer1 := Integer(Ptr.all);
Temp := Integer(Ptr.all);
Ptr.all := I... | Ada | atomic6_8.adb |
package Atomic6_Pkg is
type Int is new Integer;
pragma Atomic (Int);
Counter1 : Int;
Counter2 : Int;
Timer1 : Integer;
pragma Atomic (Timer1);
Timer2 : Integer;
pragma Atomic (Timer2);
type Arr1 is array (1..8) of Int;
Counter : Arr1;
type Arr2 is array (1..8) of Integer;
pragma Atomic_Com... | Ada | atomic6_pkg.ads |
-- { dg-do run }
with Atomic7_Pkg2; use Atomic7_Pkg2;
procedure Atomic7_1 is
I : Integer := Stamp;
pragma Atomic (I);
J : Integer := Stamp;
begin
if I /= 1 then
raise Program_Error;
end if;
end;
| Ada | atomic7_1.adb |
--- { dg-do run }
with Atomic7_Pkg1; use Atomic7_Pkg1;
procedure Atomic7_2 is
begin
if I /= 1 then
raise Program_Error;
end if;
end;
| Ada | atomic7_2.adb |
with Atomic7_Pkg2; use Atomic7_Pkg2;
package Atomic7_Pkg1 is
I : Integer := Stamp;
pragma Atomic (I);
J : Integer := Stamp;
end Atomic7_Pkg1;
| Ada | atomic7_pkg1.ads |
pragma Restrictions (No_Elaboration_Code);
package body Atomic7_Pkg2 is
T : Natural := 0;
pragma Atomic (T);
function Stamp return Natural is
begin
T := T + 1;
return T;
end;
end Atomic7_Pkg2;
| Ada | atomic7_pkg2.adb |
package Atomic7_Pkg2 is
function Stamp return Natural;
end Atomic7_Pkg2;
| Ada | atomic7_pkg2.ads |
-- { dg-do run }
procedure Atomic8 is
V : array (1 .. 2) of Natural := (0,0) with Atomic_Components;
task type TT1;
task body TT1 is
begin
while V (1) + V (2) < 1_000_000 loop
V (1) := V (1) + 1;
end loop;
end TT1;
task type TT2;
task body TT2 is
begin
while V (1) ... | Ada | atomic8.adb |
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Interfaces;
procedure Atomic9 is
Register : Interfaces.Unsigned_32;
type Interrupt_ID is range 0 .. 44;
procedure Trigger_Interrupt (IRQ : Interrupt_ID) is
NVIC_STIR : Interrupt_ID
with
Import,
Atomic,
Siz... | Ada | atomic9.adb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.