re PR fortran/69963 (ICE out of memory on displaced implicit character)

2016-09-15  Louis Krupp  <louis.krupp@zoho.com>
	PR fortran/69963
	* parse.c (reject_statement): Clear charlen pointers in implicit
	character typespecs before those charlen structures are freed.

2016-09-15  Louis Krupp  <louis.krupp@zoho.com>

	PR fortran/69963
	* gfortran.dg/misplaced_implicit_character.f90: New test.

From-SVN: r240168
This commit is contained in:
Louis Krupp 2016-09-15 23:54:40 +00:00 committed by Louis Krupp
parent 931388ce2d
commit 902d624f45
4 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2016-09-15 Louis Krupp <louis.krupp@zoho.com>
PR fortran/69963
* parse.c (reject_statement): Clear charlen pointers in implicit
character typespecs before those charlen structures are freed.
2016-09-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* simplify.c (gfc_simplify_repeat): Fix a misplaced closing ')'.

View File

@ -2399,6 +2399,29 @@ accept_statement (gfc_statement st)
}
/* Clear default character types with charlen pointers that are about
to become invalid. */
static void
clear_default_charlen (gfc_namespace *ns, const gfc_charlen *cl,
const gfc_charlen *end)
{
gfc_typespec *ts;
for (ts = &ns->default_type[0]; ts < &ns->default_type[GFC_LETTERS]; ts++)
if (ts->type == BT_CHARACTER)
{
const gfc_charlen *cl2;
for (cl2 = cl; cl2 != end; cl2 = cl2->next)
if (ts->u.cl == cl2)
{
ts->u.cl = NULL;
ts->type = BT_UNKNOWN;
break;
}
}
}
/* Undo anything tentative that has been built for the current
statement. */
@ -2406,6 +2429,8 @@ static void
reject_statement (void)
{
/* Revert to the previous charlen chain. */
clear_default_charlen (gfc_current_ns,
gfc_current_ns->cl_list, gfc_current_ns->old_cl_list);
gfc_free_charlen (gfc_current_ns->cl_list, gfc_current_ns->old_cl_list);
gfc_current_ns->cl_list = gfc_current_ns->old_cl_list;

View File

@ -1,3 +1,8 @@
2016-09-15 Louis Krupp <louis.krupp@zoho.com>
PR fortran/69963
* gfortran.dg/misplaced_implicit_character.f90: New test.
2016-09-15 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/77503

View File

@ -0,0 +1,8 @@
! { dg-do compile }
! PR fortran/69963
subroutine s
real x ! { dg-error "" }
implicit character (a) ! { dg-error "IMPLICIT statement at .1. cannot follow data declaration statement at .2." }
a1 = 'z' ! { dg-error "Symbol .a1. at .1. has no IMPLICIT type" }
end subroutine s