https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122993
Bug ID: 122993
Summary: gfortran loads module at each use statement
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gigor-ads at yandex dot ru
Target Milestone: ---
Hello!
I've generated a code with ~2K functions in single module, however, later, I'm
providing 2K Fortran-77 interfaces to this module in single file, where I'm
using this module just like:
subroutine interface1_77
use my_2k_module
call sub1_from_my_2k_module
end subroutine
subroutine interface2_77
use my_2k_module
call sub2_from_my_2k_module
end subroutine
....
so, no defence how many elements are actually loaded. A bit stupid, but it is
still valid. So, that is kinda O(N^2) task for compiler for subroutine name
resolution.
The problem that I see a really long compilation time (2-3 minutes), while
other compiler (LLVM flang, ifort/ifx) works fast (seconds). Loading only of
specific routines reduces compilation time, but it is still minutes.
When I've tried to run only syntax check with -fsyntax-only, the time is still
minutes (I'm expecting seconds, like a time for compiling original module). So,
I suppose, instead of keeping already known modules in memory, gfortran reads
modules from disk each time when it sees use statement.