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

--- Comment #5 from Rimvydas (RJ) <rimvydas.jas at gmail dot com> ---
Added initial hand-reduced reproducer.  It took quite a few iterations to
carefully cut out many small parts of original case while trying to preserve
original observed behavior of memory and walltime usage.
Memory usage during 'parse' stage when compiling passtest.F90 is in kbytes.
Size of produced phys_base_mod.mod module for import in passtest.F90 is in
bytes.

$ rm -rf *.mod *.o ; gfortran-14 -c phys_base.F08
$ /usr/bin/time -v gfortran-14 -c passtest.F90 2>&1 | grep Max && stat -c "%N:
%s" phys_base_mod.mod
        Maximum resident set size (kbytes): 42320752
'phys_base_mod.mod': 740092

$ gfortran-14 -DNOSTATIC -c phys_base.F08 && gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 12044044
'phys_base_mod.mod': 276018

$ gfortran-14 -DJAUSE -c phys_base.F08 && gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 26682644
'phys_base_mod.mod': 497977

$ gfortran-14 -DNOUSE -c phys_base.F08 && gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 3729064
'phys_base_mod.mod': 62560

$ gfortran-14 -DNOMETH -c phys_base.F08 && gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 3716652
'phys_base_mod.mod': 59611

$ gfortran-14 -DJAUSE -DNOUSE -DNOSTATIC -c phys_base.F08 && gfortran-14 -c
passtest.F90
        Maximum resident set size (kbytes): 62664
'phys_base_mod.mod': 5450

$ gfortran-14 -DNOMETH -DJAUSE -DNOUSE -DNOSTATIC -c phys_base.F08 &&
gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 40432
'phys_base_mod.mod': 965

Testing N interface blocks presence in passtest.F90
$ gfortran-14 -c phys_base.F08 && gfortran-14 -DONLY1 -c passtest.F90
        Maximum resident set size (kbytes): 976904
'phys_base_mod.mod': 740092

$ gfortran-14 -c phys_base.F08 && gfortran-14 -DONLY2 -c passtest.F90
        Maximum resident set size (kbytes): 1820344
'phys_base_mod.mod': 740092

$ gfortran-14 -c phys_base.F08 && gfortran-14 -DONLY10 -c passtest.F90
        Maximum resident set size (kbytes): 8564812
'phys_base_mod.mod': 740092

$ gfortran-14 -c phys_base.F08 && gfortran-14 -DONLY20 -c passtest.F90
        Maximum resident set size (kbytes): 16995904
'phys_base_mod.mod': 740092

$ gfortran-14 -c phys_base.F08 && gfortran-14 -c passtest.F90
        Maximum resident set size (kbytes): 42320324
'phys_base_mod.mod': 740092

The -DNOMETH hack is to limit creation of mega deeply nested model structures
with foreign structure information in INIT methods (no forward declarations
support like in other languages for just passing objects to other subroutines).
 It is possible to call initializer functions directly, but it breaks whole
oops idea.
The -DNOUSE and its reverse -DJAUSE cases indicate unexpected strange behavior
depending where the type information is imported at (module scope or method
scope).
The -DNOSTATIC no idea why it behaves like this together with other defines
used.
All four defines + N interface blocks tester seem to indicate separate
problematic issues.

Same behavior was observed with gfortran-13 on x86_64 openSUSE Tumbleweed.

Reply via email to