[Bug fortran/85088] improve diagnostic for bad INTENT declaration ('Invalid character in name at')
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 27 14:39:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85088
--- Comment #2 from janus at gcc dot gnu.org ---
This issue might actually be related to a TODO note in decl.c, which could be
removed like this:
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 258757)
+++ gcc/fortran/decl.c (working copy)
@@ -4791,13 +4791,7 @@ match_attr_spec (void)
if (match_string_p ("nt"))
{
/* Matched "intent". */
- /* TODO: Call match_intent_spec from here. */
- if (gfc_match (" ( in out )") == MATCH_YES)
- d = DECL_INOUT;
- else if (gfc_match (" ( in )") == MATCH_YES)
- d = DECL_IN;
- else if (gfc_match (" ( out )") == MATCH_YES)
- d = DECL_OUT;
+ d = match_intent_spec ();
}
}
else if (ch == 'r')
With this modification I get:
intent.f90:2:18:
integer, intent(int) :: x
1
Error: Bad INTENT specification at (1)
intent.f90:4:11:
integer, inten :: z
1
Error: Invalid character in name at (1)
So, the first case is better now, the second is (wrongly) accepted and the
third is unchanged.
TODO:
1) reject the second case
2) check for regressions
3) find out why the TODO is there in the first place (I guess there's a reason
why this simple replacement has not been done already? Probably due to item
#1?)
More information about the Gcc-bugs
mailing list