Debian Codegraph @

gcc/testsuite/gnat.dg/task_stack_align.adb

raw
1 -- { dg-do run }
2
3 with Ada.Text_IO; use Ada.Text_IO;
4 with System.Storage_Elements; use System.Storage_Elements;
5
6 procedure Task_Stack_Align is
7
8 type Align_Me is record
9 Value : Integer;
10 end record;
11 for Align_Me'Alignment use Standard'Maximum_Alignment;
12
13 procedure Check_Local_Alignment_From (Context : String) is
14 Object : Align_Me;
15 begin
16 if To_Integer (Object'Address) mod Object'Alignment /= 0 then
17 Put_Line ("alignment check failed in " & Context);
18 end if;
19 end;
20
21 task type T;
22
23 task body T is
24 begin
25 Check_Local_Alignment_From ("task T");
26 end;
27
28 Tasks : array (1 .. 50) of T;
29 begin
30 Check_Local_Alignment_From ("environment");
31 end;