This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 19925 and expansion of array constructors


paul@codesourcery.com wrote:
> 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

Heh. That is what happens with g95 and ifort on my Linux system
when I try to compile that pice of code (both consumes huge
amount of memory, and get killed).  I think I get the point ;-).

> 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

Hmm.  I slightly suspect that implementing this might be beyond my
gfortran knowledge at this stage, but I'll take a look to see what I
can do.  (If someone else is eager to implement it, don't
hesitate to do so.  The bug is not "mine", I just want it fixed.)


        Erik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]