-- { dg-do run { target i?86-*-linux* x86_64-*-linux* i?86-*-solaris2.* } } -- { dg-options "-fstack-check" } procedure Stack_Check2 is function UB return Integer is begin return 2048; end; type A is Array (Positive range <>) of Integer; procedure Consume_Stack (N : Integer) is My_A : A (1..UB); -- 8 KB dynamic begin My_A (1) := 0; if N <= 0 then return; end if; Consume_Stack (N-1); end; begin begin Consume_Stack (Integer'Last); raise Program_Error; exception when Storage_Error => null; end; Consume_Stack (128); end;