PR ipa/83051
[official-gcc.git] / gcc / testsuite / gnat.dg / task_stack_align.adb
blob1151a913beb2739fa14d14f614ee0a8b131a61ce
1 -- { dg-do run }
3 with Ada.Text_IO; use Ada.Text_IO;
4 with System.Storage_Elements; use System.Storage_Elements;
6 procedure Task_Stack_Align is
8 type Align_Me is record
9 Value : Integer;
10 end record;
11 for Align_Me'Alignment use Standard'Maximum_Alignment;
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;
21 task type T;
23 task body T is
24 begin
25 Check_Local_Alignment_From ("task T");
26 end;
28 Tasks : array (1 .. 50) of T;
29 begin
30 Check_Local_Alignment_From ("environment");
31 end;