https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84487

Tomáš Trnka <trnka at scm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trnka at scm dot com

--- Comment #12 from Tomáš Trnka <trnka at scm dot com> ---
(In reply to Wilco from comment #11)
> I'm not sure it's the same problem but the huge size increases I noticed are
> due to not optimizing zeroes from initializers, so we end up with huge
> rodata with only zeroes in it.

It indeed is the same problem. The change in r254427 causes def_init to be
generated for all types in a module (even if there's nothing to initialize), so
any type with a large array in it will end up taking lots of space in rodata.

Example:

module FooModule
   type Foo
      integer :: array(1000000)
   end type
end module
program def_init_size
   use FooModule

   type(Foo) :: x

   x%array(1) = 1
   write(*,*) x%array(1)
end program

     VM SIZE                                                    FILE SIZE
 --------------                                              --------------
  50.0%  3.81Mi .rodata                                       3.81Mi  99.6%
     100.0%  3.81Mi __foomodule_MOD___def_init_foomodule_Foo      3.81Mi 100.0%
       0.0%      60 [section .rodata]                                 60   0.0%
       0.0%      48 __foomodule_MOD___vtab_foomodule_Foo              48   0.0%
       0.0%      28 options.1.3571                                    28   0.0%
       0.0%       4 _IO_stdin_used                                     4   0.0%
  50.0%  3.81Mi .bss                                               0   0.0%
     100.0%  3.81Mi x.3565                                             0   NAN%
       0.0%      31 [section .bss]                                     0   NAN%
       0.0%       1 completed.7132                                     0   NAN%

Reply via email to