public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: g77 large array
@ 2003-10-15 10:40 Robert Dewar
  2003-10-15 17:58 ` Dale Johannesen
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 2003-10-15 10:40 UTC (permalink / raw)
  To: susukita, toon; +Cc: gcc

> In this case, two arrays do not need memory at the same time.
> Cannot SUBROUTINE B use the same memory area as A in Fortran compiler,
> even if I do not declare explicitly COMMON I?
> I should write about the machine.

Usually convention in Fortran is to allocate all storage statically. So indeed
one would not expect these two arrays to overlap. I am not sure about the current
Fortran standard, but earlier Fortran standards certainly *allowed* stack allocation
of such arrays, but in practice, static allocation (also certainly allowed) was
so standard, that all compilers do static allocation.

So what you are seeing makes perfect sense

^ permalink raw reply	[flat|nested] 8+ messages in thread
* g77 large array
@ 2003-10-14  8:30 Susukita Ryutaro
  2003-10-14 21:30 ` Toon Moene
  0 siblings, 1 reply; 8+ messages in thread
From: Susukita Ryutaro @ 2003-10-14  8:30 UTC (permalink / raw)
  To: gcc; +Cc: susukita

This may not be a bug, but I hope it will be fixed.

      CALL A
      END

      SUBROUTINE A
      INTEGER I(33554432)
      I(33554432) = 0
      END

I can compile and execute the program successfully like:

> g77 test.f
> ./a.out

But if I add SUBROUTINE B, it fails with 'Segmentation fault'. 

      CALL A
      CALL B
      END

      SUBROUTINE A
      INTEGER I(33554432)
      I(33554432) = 0
      END

      SUBROUTINE B
      INTEGER I(8388608)
      END

Even if I do not call B, it fails with 'Segmentation fault'. 

      CALL A
      END

      SUBROUTINE A
      INTEGER I(33554432)
      I(33554432) = 0
      END

      SUBROUTINE B
      INTEGER I(8388608)
      END

My environment is

> g77 -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --enable-languages=f77
Thread model: posix
gcc version 3.3.1

SUSUKITA, Ryutaro
The Institute of Physical and Chemical Research (RIKEN)
Computational Astrophysics Laboratory

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-10-16  4:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 10:40 g77 large array Robert Dewar
2003-10-15 17:58 ` Dale Johannesen
2003-10-15 20:32   ` Toon Moene
2003-10-15 20:49     ` Dale Johannesen
2003-10-16  8:12       ` Susukita Ryutaro
  -- strict thread matches above, loose matches on Subject: below --
2003-10-14  8:30 Susukita Ryutaro
2003-10-14 21:30 ` Toon Moene
2003-10-15  8:30   ` Susukita Ryutaro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).