This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PR 19925 and expansion of array constructors
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Erik Edelmann <eedelman at acclab dot helsinki dot fi>
- Date: Thu, 30 Jun 2005 20:38:12 +0100
- Subject: Re: PR 19925 and expansion of array constructors
- Organization: CodeSourcery
- References: <20050630183753.GA16258@acclab.helsinki.fi>
On Thursday 30 June 2005 19:37, Erik Edelmann wrote:
> My question is: where is the correct place to expand the
> constructor? And why not expand all constructors, small as well as
> large, in gfc_expand_constructor? Since they'll have to be
> eaxpanded anyway at some point, why not do it from the beginning?
Expanding everything takes insane amounts of memory and produces unreasonably
large executables. An example from real code:
program killme
integer, parameter :: N = 200000000
integer :: i
integer :: a(N) = (/(0, i = 1, N)/)
call foo(a)
end program
For really big variables (Where anything > GFC_MAX_AC_EXPAND counts as big) we
want to expand these at runtime. ie. the above code becomes:
program killme
integer, parameter :: N = 200000000
integer :: i
integer, save :: a(N)
logical :: _initialized_a = .false.
if (.not. _initialized_a) then
do _i = 1, N
a(_i) = 0
end do
end if
call foo(a)
end program
It's probably worth special casing initialization-to-zero, but we still want
other cases to work.
Note there are obviously other places than need to check GFC_MAX_AC_EXPAND as
the above case already takes an unreasonable amount of time to compile
(before it fails).
Paul