https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95847
--- Comment #6 from kargl at gcc dot gnu.org --- (In reply to Martin Liška from comment #5) > I can only confirm it's a Fortran issue. > Can please anybody from Fortran folks take a look? First, the caveat, the Fortran code in the attached example is invalid so a compiler can to do whatever it wants, including dying with an ICE. Split the example code into a file with only the module (say, d.f90) and a file with only the function foo_suite (say, e.f90). I get % gfcx -c --coverage d.f90 % gfcx -c --coverage e.f90 with no ICE. It seems that the strengthen assumption in the git commit gets confused on where function information comes from. Just a SWAG. Likely, gfortran reads the newly created 'foo.mod' to get information about the subroutine sbr, so gfortran simply records the location where it obtains the information about sbr. That then means the location for sbr is set to the line 'use foo'. Why --coverage finds the `end subroutine` at line 4 then becomes a mystery. Uncompressing the module shows that no location information is stored in a module. % cat foo.mod | gunzip GFORTRAN module version '15' created from d.f90 (() () () () () () () () () () () () () () () () () () () () () () () () () () ()) () () () () () (2 'foo' 'foo' '' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN UNKNOWN 0 0) () (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0) 3 'sbr' 'foo' '' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC DECL UNKNOWN 0 0 SUBROUTINE IMPLICIT_PURE) () (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0) ) ('foo' 0 2 'sbr' 0 3) So, it seems the strengthened assumption isn't so strong.