summaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authordomob <domob@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-03 08:01:51 +0000
committerdomob <domob@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-03 08:01:51 +0000
commit0c3f80cf30365b7ee5b616d609aa7bccf63a4255 (patch)
treeab6ea012d837fff217565926dab37412151bd71e /gcc/fortran/parse.c
parent25db5a239c7374381c4856c74229e86043799351 (diff)
downloadgcc-0c3f80cf30365b7ee5b616d609aa7bccf63a4255.tar.gz
2010-09-03 Daniel Kraft <d@domob.eu>
PR fortran/44602 * gfortran.h (struct gfc_code): Renamed `whichloop' to `which_construct' as this is no longer restricted to loops. * parse.h (struct gfc_state_data): New field `construct'. * match.c (match_exit_cycle): Handle EXIT from non-loops. * parse.c (push_state): Set `construct' field. * resolve.c (resolve_select_type): Extend comment. * trans-stmt.c (gfc_trans_if): Add exit label. (gfc_trans_block_construct), (gfc_trans_select): Ditto. (gfc_trans_simple_do): Store exit/cycle labels on the gfc_code itself. (gfc_trans_do), (gfc_trans_do_while): Ditto. (gfc_trans_exit): Use new name `which_construct' instead of `whichloop'. (gfc_trans_cycle): Ditto. (gfc_trans_if_1): Use fold_build3_loc instead of fold_build3. 2010-09-03 Daniel Kraft <d@domob.eu> PR fortran/44602 * gfortran.dg/exit_2.f08; Adapt error messages. * gfortran.dg/exit_3.f08: New test. * gfortran.dg/exit_4.f08: New test. * gfortran.dg/exit_5.f03: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index cbb945aa9a5..4632a250294 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -989,6 +989,13 @@ push_state (gfc_state_data *p, gfc_compile_state new_state, gfc_symbol *sym)
p->sym = sym;
p->head = p->tail = NULL;
p->do_variable = NULL;
+
+ /* If this the state of a construct like BLOCK, DO or IF, the corresponding
+ construct statement was accepted right before pushing the state. Thus,
+ the construct's gfc_code is available as tail of the parent state. */
+ gcc_assert (gfc_state_stack);
+ p->construct = gfc_state_stack->tail;
+
gfc_state_stack = p;
}