diff options
author | Daniel Kraft <d@domob.eu> | 2010-07-23 11:53:45 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-07-23 11:53:45 +0200 |
commit | 61b644c2ae3055e797ba6c4de28888565b667b35 (patch) | |
tree | 3d969e0ac991bf7dbb5c018e6d1d583e084a1d98 /gcc/fortran/symbol.c | |
parent | ed3100b2ed8224bafd294f7c56390daed9bbc2bd (diff) | |
download | gcc-61b644c2ae3055e797ba6c4de28888565b667b35.zip gcc-61b644c2ae3055e797ba6c4de28888565b667b35.tar.gz gcc-61b644c2ae3055e797ba6c4de28888565b667b35.tar.bz2 |
re PR fortran/44709 (BLOCK and GOTO/EXIT/CYCLE)
2010-07-23 Daniel Kraft <d@domob.eu>
PR fortran/44709
* gfortran.h (gfc_find_symtree_in_proc): New method.
* symbol.c (gfc_find_symtree_in_proc): New method.
* match.c (match_exit_cycle): Look for loop name also in parent
namespaces within current procedure.
2010-07-23 Daniel Kraft <d@domob.eu>
PR fortran/44709
* gfortran.dg/exit_1.f08: New test.
* gfortran.dg/exit_2.f08: New test.
From-SVN: r162450
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index c12ea23..18f7b25 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2565,6 +2565,27 @@ select_type_insert_tmp (gfc_symtree **st) } +/* Look for a symtree in the current procedure -- that is, go up to + parent namespaces but only if inside a BLOCK. Returns NULL if not found. */ + +gfc_symtree* +gfc_find_symtree_in_proc (const char* name, gfc_namespace* ns) +{ + while (ns) + { + gfc_symtree* st = gfc_find_symtree (ns->sym_root, name); + if (st) + return st; + + if (!ns->construct_entities) + break; + ns = ns->parent; + } + + return NULL; +} + + /* Search for a symtree starting in the current namespace, resorting to any parent namespaces if requested by a nonzero parent_flag. Returns nonzero if the name is ambiguous. */ |