https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100724
Bug ID: 100724
Summary: -fwhole-program breaks module use
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: fx at gnu dot org
Target Milestone: ---
I found that trying gfortran -fwhole-program failed to link a case I tried,
with undefined references to routines with interface blocks. It's OK with
gfortran 10.
Here's a trivial example (on Debian 10, but I don't suppose that matters):
$ gfortran-11 --version
GNU Fortran (GCC) 11.1.0
$ cat test.f90
module tw
interface
real function twice (x)
end function twice
end interface
end module tw
real function twice (x)
twice = 2*x
end function twice
use tw
read *, x
print *, twice (x)
end
$ gfortran-11 -O -fwhole-program test.f90
/usr/bin/ld: /tmp/ccBKHiLp.o: in function `MAIN__':
test.f90:(.text+0x7d): undefined reference to `twice_'
collect2: error: ld returned 1 exit status