http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-27 
17:22:15 UTC ---
(In reply to comment #6)
> (In reply to comment #2)
> > Thus, in some way, the repeat count must come back. One possibility is to
> > handle the special case /<array_size>*<value>/, which is equivalent to
> > a scalar initialization. I think that should cover the most common case.
> 
> IIRC, as implemented the array constructor is completely unrolled, for each
> element an entry in the splay tree is generated.

Yes - at least since dropping the repeat count, which your patch did.

> One could apply the -fmax-array-constructor=<value> restrictions used e.g. for
> PARAMETER arrays and do not unroll arrays of size larger than <value> but do 
> it
> on runtime.

As written, I think it should be sufficient to support the initialization via a
scalar. In terms of the trans*.c files that already works:
  real :: a(3) = 0
thus, there is no reason why one should be able to set sym->value also for
  real a(3)
  data a/3*0/

That is: If - and only if - one has <repeat count> == size(array), i.e. a
whole-array initialization, one changes the initialization from:
  sym->value  =  [ ( <value>, i = 1, <repeat count>) ]
to
  sym->value  =  <value>

That should require some reshoveling in the code, but sounds much cleaner as
-fmax-array-constructor= tweaking. Additionally, it will generate much faster
code for "data a/10000000*0.0/" as it gets translated into "static real a =
{}".

Reply via email to