Follow up to PR 43205

subroutine test()
  integer, SAVE :: hugeArray(1000,1000) = 42

generates a huge initializer of the type:

  static integer(kind=4) hugeArray = {42, 42, 42, ...., 42};

It would be possible to reduce the compile time and object size by initializing
it a run time:

  static integer(kind=4) hugeArray;
  static logical initialized = false
  if (!initialized)
    {
      initialized = true
      for(i=0, i < size; i++) hugeArray = 42;
    }

The question is only how big the array should be. I think one common case of
this could also be  -finit-integer=42.


-- 
           Summary: Initializer of huge static arrays should be improved
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to