aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2013-02-02 09:50:58 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2013-02-02 09:50:58 +0000
commit0cab6b73df8b8fc78a6f68e664867d1dbbeea9e5 (patch)
tree0496b4b0755833aa8aaae77c8eb7e594bdb2a796 /gcc/fortran/parse.c
parent18d2405e9d513dd169ed87d8194feed34ce73798 (diff)
downloadgcc-0cab6b73df8b8fc78a6f68e664867d1dbbeea9e5.zip
gcc-0cab6b73df8b8fc78a6f68e664867d1dbbeea9e5.tar.gz
gcc-0cab6b73df8b8fc78a6f68e664867d1dbbeea9e5.tar.bz2
re PR fortran/50627 (Error recovery: ICE in gfc_free_namespace after diagnosing missing end of construct)
2013-02-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/50627 PR fortran/56054 * decl.c (gfc_match_end): Remove half-ready namespace from parent if the end of a block is missing. * parse.c (parse_module): Do not put namespace into gsymbol on error. 2013-02-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/50627 PR fortran/56054 * gfortran.dg/block_12.f90: New test. * gfortran.dg/module_error_1.f90: New test. From-SVN: r195684
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 94d204c..6ee7b7f 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -4291,6 +4291,7 @@ parse_module (void)
{
gfc_statement st;
gfc_gsymbol *s;
+ bool error;
s = gfc_get_gsymbol (gfc_new_block->name);
if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_MODULE))
@@ -4304,6 +4305,7 @@ parse_module (void)
st = parse_spec (ST_NONE);
+ error = false;
loop:
switch (st)
{
@@ -4322,12 +4324,15 @@ loop:
gfc_error ("Unexpected %s statement in MODULE at %C",
gfc_ascii_statement (st));
+ error = true;
reject_statement ();
st = next_statement ();
goto loop;
}
- s->ns = gfc_current_ns;
+ /* Make sure not to free the namespace twice on error. */
+ if (!error)
+ s->ns = gfc_current_ns;
}