aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorLouis Krupp <louis.krupp@zoho.com>2015-08-24 16:29:59 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-08-24 16:29:59 +0000
commit9f7ba2088e4ebfa747f51a107d25f05c29df51b7 (patch)
tree6e41ed5457b2c0579a7c84fd81d880193a273f76 /gcc/fortran/decl.c
parent2021ff273d58600199d0b2fb394c1ebee9bbeec0 (diff)
downloadgcc-9f7ba2088e4ebfa747f51a107d25f05c29df51b7.zip
gcc-9f7ba2088e4ebfa747f51a107d25f05c29df51b7.tar.gz
gcc-9f7ba2088e4ebfa747f51a107d25f05c29df51b7.tar.bz2
re PR fortran/62536 (ICE (segfault) for invalid END BLOCK statement)
PR fortran/62536 PR fortran/66175 * decl.c (gfc_match_end): Clean up nested BLOCKs. * parse.c (parse_block_construct): Deal gracefully with cleaned-up BLOCKs. * gfortran.dg/block_end_error_1.f90: New test. * gfortran.dg/blocks_nested_incomplete_1.f90: New test. From-SVN: r227135
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index ebc88ea..6829d17 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -6483,7 +6483,7 @@ cleanup:
/* If we are missing an END BLOCK, we created a half-ready namespace.
Remove it from the parent namespace's sibling list. */
- if (state == COMP_BLOCK)
+ while (state == COMP_BLOCK)
{
parent_ns = gfc_current_ns->parent;
@@ -6506,6 +6506,8 @@ cleanup:
gfc_free_namespace (gfc_current_ns);
gfc_current_ns = parent_ns;
+ gfc_state_stack = gfc_state_stack->previous;
+ state = gfc_current_state ();
}
return MATCH_ERROR;