g77 large array

Dale Johannesen dalej@apple.com
Wed Oct 15 20:49:00 GMT 2003


On Wednesday, October 15, 2003, at 11:31  AM, Toon Moene wrote:
> Dale Johannesen wrote:
>> On Tuesday, October 14, 2003, at 08:00  PM, Robert Dewar wrote:
>>>> 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?
>
>> Actually, most modern Fortran compilers have a switch to control 
>> this.  g77 documents
>> -fautomatic to do what you want.   I haven't tried it; the doc also 
>> claims it is the default, so
>> it may not be working right in your environment, or it may have some 
>> limit on how much
>> stack space it will allocate.
>
> Well, the reason to have a maximum-size-to-put-on-the-stack for arrays 
> when the first release of g77 was made (early '95) was that a lot of 
> the target systems had small stack sizes (by default and as a system 
> wide maximum).  If the compiler just allocated arbitrarily sized 
> arrays on the stack, much more people would have run into segmentation 
> faults than are now.

Sounds like a good place for a compile-time default and command-line 
switch to override.

> However, g77 (like all of GCC) is free software.  You can up the limit 
> yourself (and rebuild the compiler).  The limit is in the file 
> gcc/f/com.c, constant FFECOM_sizeMAXSTACKITEM.
>
> Hope this helps,

Not me; just delurked for a moment to help susukita...let us know what 
you come up with....



More information about the Gcc mailing list