This is a bug which needs to be fixed before -fwhole-file can be enabled by default. Otherwise, the test results look fine. (Note: I tested with -fwhole-file enabled by default and including the patch for PR 44945.)
Extended test case: gfortran.fortran-torture/execute/entry_4.f90 real, external :: g 1 Error: Return type mismatch of function 'g' at (1) (REAL(4)/INTEGER(4)) Test case: function f() integer :: f real :: g entry g() end function integer, external :: f real, external :: g integer :: ff real :: gg ff = f() gg = g() end -- Summary: -fwhole-file: Bogus error message with ENTRY and different result types Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45030