Commit e79e6763 by Fritz Reese Committed by Fritz Reese

re PR fortran/77584 (Unclassifiable statement error with procedure pointer using…

re PR fortran/77584 (Unclassifiable statement error with procedure pointer using template named "structure_")

2016-09-19  Fritz Reese  <fritzoreese@gmail.com>

	PR fortran/77584
	* gcc/fortran/decl.c (match_record_decl, gfc_match_decl_type_spec):
	Fixes to handling of structure/record from declaration-type-spec.

	* gcc/testsuite/gfortran.dg/dec_structure_15.f90: New testcase.

From-SVN: r240230
parent 471a0d47
2016-09-19 Fritz Reese <fritzoreese@gmail.com>
PR fortran/77584
* decl.c (match_record_decl, gfc_match_decl_type_spec): Fixes to
handling of structure/record from declaration-type-spec.
2016_09_17 Louis Krupp <louis.krupp@zoho.com> 2016_09_17 Louis Krupp <louis.krupp@zoho.com>
PR fortran/68078 PR fortran/68078
......
...@@ -2909,12 +2909,14 @@ done: ...@@ -2909,12 +2909,14 @@ done:
/* Matches a RECORD declaration. */ /* Matches a RECORD declaration. */
static match static match
match_record_decl (const char *name) match_record_decl (char *name)
{ {
locus old_loc; locus old_loc;
old_loc = gfc_current_locus; old_loc = gfc_current_locus;
match m;
if (gfc_match (" record") == MATCH_YES) m = gfc_match (" record /");
if (m == MATCH_YES)
{ {
if (!gfc_option.flag_dec_structure) if (!gfc_option.flag_dec_structure)
{ {
...@@ -2923,17 +2925,20 @@ match_record_decl (const char *name) ...@@ -2923,17 +2925,20 @@ match_record_decl (const char *name)
"-fdec-structure"); "-fdec-structure");
return MATCH_ERROR; return MATCH_ERROR;
} }
if (gfc_match (" /%n/", name) != MATCH_YES) m = gfc_match (" %n/", name);
{ if (m == MATCH_YES)
gfc_error ("Structure name expected after RECORD at %C"); return MATCH_YES;
gfc_current_locus = old_loc;
return MATCH_ERROR;
}
return MATCH_YES;
} }
gfc_current_locus = old_loc; gfc_current_locus = old_loc;
if (gfc_option.flag_dec_structure
&& (gfc_match (" record% ") == MATCH_YES
|| gfc_match (" record%t") == MATCH_YES))
gfc_error ("Structure name expected after RECORD at %C");
if (m == MATCH_NO)
return MATCH_NO; return MATCH_NO;
return MATCH_ERROR;
} }
/* Matches a declaration-type-spec (F03:R502). If successful, sets the ts /* Matches a declaration-type-spec (F03:R502). If successful, sets the ts
...@@ -3128,26 +3133,26 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) ...@@ -3128,26 +3133,26 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
else else
{ {
/* Match nested STRUCTURE declarations; only valid within another /* Match nested STRUCTURE declarations; only valid within another
structure declaration. */ structure declaration. */
m = gfc_match (" structure"); if (gfc_option.flag_dec_structure
if (m == MATCH_ERROR) && (gfc_current_state () == COMP_STRUCTURE
return MATCH_ERROR; || gfc_current_state () == COMP_MAP))
else if (m == MATCH_YES) {
{ m = gfc_match (" structure");
if ( gfc_current_state () != COMP_STRUCTURE if (m == MATCH_YES)
&& gfc_current_state () != COMP_MAP) {
return MATCH_ERROR; m = gfc_match_structure_decl ();
if (m == MATCH_YES)
m = gfc_match_structure_decl (); {
if (m == MATCH_YES) /* gfc_new_block is updated by match_structure_decl. */
{ ts->type = BT_DERIVED;
/* gfc_new_block is updated by match_structure_decl. */ ts->u.derived = gfc_new_block;
ts->type = BT_DERIVED; return MATCH_YES;
ts->u.derived = gfc_new_block; }
return MATCH_YES; }
} if (m == MATCH_ERROR)
return MATCH_ERROR; return MATCH_ERROR;
} }
/* Match CLASS declarations. */ /* Match CLASS declarations. */
m = gfc_match (" class ( * )"); m = gfc_match (" class ( * )");
......
2016-09-19 Fritz Reese <fritzoreese@gmail.com>
PR fortran/77584
* gfortran.dg/dec_structure_15.f90: New testcase.
2016-09-19 Richard Biener <rguenther@suse.de> 2016-09-19 Richard Biener <rguenther@suse.de>
PR middle-end/77605 PR middle-end/77605
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment