gcc-2.95: Program dies with Sig 11 before doing anything - RH Linux 5.2

Toon Moene toon@moene.indiv.nluug.nl
Mon Jun 14 13:04:00 GMT 1999


Sylvain Pion wrote:

> On Sun, Jun 13, 1999 at 07:35:30PM +0200, Toon Moene wrote:
> > What this does is make the compiler generate code to allocate all local
> > arrays on the stack, regardless of size.
> 
> If you go beyond the default stack size (8MB), you'll get a sig11.
> Did you try running it with "unlimit stacksize" ?
> For example, just run the following:

Ah, sorry, I see that my mail was less than clear.  Try the following
Fortran source:

      common /com/ a(20000000)
      a(1) = 1.
      print*, a(1)
      call sub
      end
      subroutine sub
      dimension b(10000000)
      b(1) = 2.
      print*, b(1)
      end

This should pass (as it does), even if b were allocated on the stack
with the following stack size limit:

[toon@moene g77-bugs]$ ulimit -s
65536

However, as distributed, g77 will allocate b statically, because it is
larger than 32 Kbyte;  I can simulate that with the compiler as I
modified it by compiling it thusly:

[toon@moene g77-bugs]$ /usr/rel/bin/g77 -fno-automatic s.f
[toon@moene g77-bugs]$ ./a.out
Segmentation fault (core dumped)

For completeness:

[toon@moene g77-bugs]$ /usr/rel/bin/g77 -v
g77 version gcc-2.95 19990613 (prerelease) (from FSF-g77 version 0.5.25
19990526 (prerelease))
Driving: /usr/rel/bin/g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/rel/lib/gcc-lib/i686-pc-linux-gnu/gcc-2.95/specs
gcc version gcc-2.95 19990613 (prerelease)
... etc ...

As I said, stock Red Hat Linux 5.2.

Cheers,

-- 
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://world.std.com/~burley/g77.html


More information about the Gcc mailing list