http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50525
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-27
14:27:39 UTC ---
The patch causes regressions as it comes before the check in resolve_variable
(search for "before the ENTRY", which covers a similar issue (cf PR 25090).
Namely:
gfortran.dg/entry_dummy_ref_1.f90
gfortran.dg/entry_dummy_ref_2.f90
False positive - ("n" used in a specification expression):
gfortran.dg/entry_array_specs_2.f
* * *
From the F2008 standard ("12.6.2.6 ENTRY statement", para 7):
"In a subprogram, a name that appears as a dummy argument in an ENTRY
statement shall not appear in an executable statement preceding that ENTRY
statement, unless it also appears in a FUNCTION, SUBROUTINE, or ENTRY
statement that precedes the executable statement."
* * *
Regarding resolve_variable: As cs_base == NULL, the existing check
5086 /* Deal with forward references to entries during resolve_code, to
5087 satisfy, at least partially, 12.5.2.5. */
5088 if (gfc_current_ns->entries
5089 && current_entry_id == sym->entry_id
5090 && cs_base
fails and, hence, there is no error.
* * *
Side remarks:
a) "before the ENTRY statement in which it is a parameter"
-> Misuse of the term "parameter"
b) "warning: ‘master.0.sub’ defined but not used"
-> Declare as DECL_ARTIFICIAL to avoid warning - or to handle it better if the
warning itself makes sense.