OSDN Git Service

PR target/10127
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gnat.dg / stack_check1.adb
1 -- { dg-do run }
2 -- { dg-options "-fstack-check" }
3
4 -- This test requires architecture- and OS-specific support code for unwinding
5 -- through signal frames (typically located in *-unwind.h) to pass.  Feel free
6 -- to disable it if this code hasn't been implemented yet.
7
8 procedure Stack_Check1 is
9
10   type A is Array (1..2048) of Integer;
11
12   procedure Consume_Stack (N : Integer) is
13     My_A : A; -- 8 KB static
14   begin
15     My_A (1) := 0;
16     if N <= 0 then
17       return;
18     end if;
19     Consume_Stack (N-1);
20   end;
21
22   Task T;
23
24   Task body T is
25   begin
26     begin
27       Consume_Stack (Integer'Last);
28       raise Program_Error;
29     exception
30       when Storage_Error => null;
31     end;
32
33     Consume_Stack (128);
34   end;
35
36 begin
37   null;
38 end;