aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorMikael Morin <mikael.morin@sfr.fr>2011-08-19 00:42:38 +0200
committerMikael Morin <mikael@gcc.gnu.org>2011-08-18 22:42:38 +0000
commitdf1a69f6a85e6c82e206388daa459f06d2e92876 (patch)
treecd909034298135072ec57ac3e175166acb6dba01 /gcc/fortran/parse.c
parenta7ad08aef73fd2c4219a31a419e41ce2e5408a09 (diff)
downloadgcc-df1a69f6a85e6c82e206388daa459f06d2e92876.zip
gcc-df1a69f6a85e6c82e206388daa459f06d2e92876.tar.gz
gcc-df1a69f6a85e6c82e206388daa459f06d2e92876.tar.bz2
re PR fortran/50071 (gfortran does not distinguish labels in different type scoping units)
2011-08-19 Mikael Morin <mikael.morin@sfr.fr> PR fortran/50071 * gfortran.h (gfc_exec_op): New constant EXEC_END_NESTED_BLOCK. * parse.c (check_statement_label): Accept ST_END_BLOCK and ST_END_ASSOCIATE as valid branch target. (accept_statement): Change EXEC_END_BLOCK to EXEC_END_NESTED_BLOCK. Add EXEC_END_BLOCK code in the ST_END_BLOCK and ST_END_ASSOCIATE cases. * resolve.c (find_reachable_labels): Change EXEC_END_BLOCK to EXEC_END_NESTED_BLOCK. (resolve_branch): Ditto. (resolve_code): Add EXEC_END_NESTED_BLOCK case. * st.c (gfc_free_statement): Ditto. * trans.c (trans_code): Ditto. 2011-08-19 Mikael Morin <mikael.morin@sfr.fr> PR fortran/50071 * gfortran.dg/end_block_label_1.f90: New test. * gfortran.dg/end_associate_label_1.f90: New test. From-SVN: r177885
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 0aaad90..aab711c 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1115,6 +1115,8 @@ check_statement_label (gfc_statement st)
case ST_ENDIF:
case ST_END_SELECT:
case ST_END_CRITICAL:
+ case ST_END_BLOCK:
+ case ST_END_ASSOCIATE:
case_executable:
case_exec_markers:
type = ST_LABEL_TARGET;
@@ -1627,6 +1629,18 @@ accept_statement (gfc_statement st)
case ST_END_CRITICAL:
if (gfc_statement_label != NULL)
{
+ new_st.op = EXEC_END_NESTED_BLOCK;
+ add_statement ();
+ }
+ break;
+
+ /* In the case of BLOCK and ASSOCIATE blocks, there cannot be more than
+ one parallel block. Thus, we add the special code to the nested block
+ itself, instead of the parent one. */
+ case ST_END_BLOCK:
+ case ST_END_ASSOCIATE:
+ if (gfc_statement_label != NULL)
+ {
new_st.op = EXEC_END_BLOCK;
add_statement ();
}