comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Can't set executable stack size during compilation
Date: Wed, 04 Jan 2012 17:27:59 +0100
Date: 2012-01-04T17:27:59+01:00	[thread overview]
Message-ID: <4f047e0f$0$6582$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <ce6c46af-03e5-43bf-aa62-e7415061cf64@n6g2000vbg.googlegroups.com>

On 04.01.12 16:49, Erich wrote:
> I have a problem setting the stack size of a GNAT made program during
> compilation. It is a bit memory extensive and sometimes yields a
> storage error with the standard stack size (I'd prefer to avoid the
> heap for the time being).
> 
> None of the methods described here:
> 
> http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Setting-Stack-Size-from-gnatlink.html
> 
> so far had any effect on the executable. (The -Xlinker version yields
> a linker error when set as link option in GNAT-GPS.) Using ulimit -s
> 32768 manually in the shell solves the problem, but this is not a good
> option for final deployment.

This looked like having relevant information. The last paragraph
hints at setrlimit(2).

http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.apps/2008-12/msg00068.html


FWIW, I made a little test program; I think it is legal
but it crashes consistently when translated with GNAT/GCC.
With -fstack-check given, the most unexpected thing to see is a
segmentation fault!

procedure OnStack is

   type Num is range 1 .. 10000;
   type Index is range 1 .. 512;
   type Table is array (Index, Index) of Num;

   type Big is record
      X1, X2, X3, X4, X5: Table;
   end record;

   function Add (A, B : Big) return Big is
      Result : Big;

      function Add_Component (Left, Right: Table) return Table is
         Result : Table;
      begin
         for M in Left'Range loop
            for N in Right'Range loop
               Result (M, N) := Left(M, N) + Right(M, N);
            end loop;
         end loop;
         return Result;
      end Add_Component;

   begin
      Result.X1 := Add_Component (A.X1, B.X1);
      Result.X2 := Add_Component (A.X2, B.X2);
      Result.X3 := Add_Component (A.X3, B.X3);
      Result.X4 := Add_Component (A.X4, B.X4);
      Result.X5 := Add_Component (A.X5, B.X5);
      return Result;
   end Add;

   X, Y: Big;
   Data : Big;
begin
   Data := Add (X, Y);
end OnStack;



  reply	other threads:[~2012-01-04 16:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 15:49 Can't set executable stack size during compilation Erich
2012-01-04 16:27 ` Georg Bauhaus [this message]
2012-01-04 17:22   ` Bill Findlay
2012-01-04 21:36     ` Georg Bauhaus
2012-01-05  1:06       ` Randy Brukardt
2012-01-05  4:35         ` Bill Findlay
2012-01-05 10:19           ` Georg Bauhaus
2012-01-05 12:35             ` Erich
2012-01-05  3:03   ` Jerry
2012-01-05 13:20   ` Mark Lorenzen
2012-01-05  3:12 ` Jerry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox