mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-08 19:20:44 +08:00
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
This commit is contained in:
parent
a7ad08aef7
commit
df1a69f6a8
@ -1,3 +1,18 @@
|
||||
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-18 Mikael Morin <mikael.morin@sfr.fr>
|
||||
|
||||
PR fortran/50071
|
||||
|
@ -2048,8 +2048,8 @@ gfc_association_list;
|
||||
/* Executable statements that fill gfc_code structures. */
|
||||
typedef enum
|
||||
{
|
||||
EXEC_NOP = 1, EXEC_END_BLOCK, EXEC_ASSIGN, EXEC_LABEL_ASSIGN,
|
||||
EXEC_POINTER_ASSIGN, EXEC_CRITICAL, EXEC_ERROR_STOP,
|
||||
EXEC_NOP = 1, EXEC_END_NESTED_BLOCK, EXEC_END_BLOCK, EXEC_ASSIGN,
|
||||
EXEC_LABEL_ASSIGN, EXEC_POINTER_ASSIGN, EXEC_CRITICAL, EXEC_ERROR_STOP,
|
||||
EXEC_GOTO, EXEC_CALL, EXEC_COMPCALL, EXEC_ASSIGN_CALL, EXEC_RETURN,
|
||||
EXEC_ENTRY, EXEC_PAUSE, EXEC_STOP, EXEC_CONTINUE, EXEC_INIT_ASSIGN,
|
||||
EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_WHILE, EXEC_SELECT, EXEC_BLOCK,
|
||||
|
@ -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;
|
||||
@ -1625,6 +1627,18 @@ accept_statement (gfc_statement st)
|
||||
case ST_ENDIF:
|
||||
case ST_END_SELECT:
|
||||
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;
|
||||
|
@ -8202,7 +8202,7 @@ find_reachable_labels (gfc_code *block)
|
||||
up through the code_stack. */
|
||||
for (c = block; c; c = c->next)
|
||||
{
|
||||
if (c->here && c->op != EXEC_END_BLOCK)
|
||||
if (c->here && c->op != EXEC_END_NESTED_BLOCK)
|
||||
bitmap_set_bit (cs_base->reachable_labels, c->here->value);
|
||||
}
|
||||
|
||||
@ -8381,7 +8381,7 @@ resolve_branch (gfc_st_label *label, gfc_code *code)
|
||||
|
||||
if (stack)
|
||||
{
|
||||
gcc_assert (stack->current->next->op == EXEC_END_BLOCK);
|
||||
gcc_assert (stack->current->next->op == EXEC_END_NESTED_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -9117,6 +9117,7 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
|
||||
{
|
||||
case EXEC_NOP:
|
||||
case EXEC_END_BLOCK:
|
||||
case EXEC_END_NESTED_BLOCK:
|
||||
case EXEC_CYCLE:
|
||||
case EXEC_PAUSE:
|
||||
case EXEC_STOP:
|
||||
|
@ -89,6 +89,7 @@ gfc_free_statement (gfc_code *p)
|
||||
{
|
||||
case EXEC_NOP:
|
||||
case EXEC_END_BLOCK:
|
||||
case EXEC_END_NESTED_BLOCK:
|
||||
case EXEC_ASSIGN:
|
||||
case EXEC_INIT_ASSIGN:
|
||||
case EXEC_GOTO:
|
||||
|
@ -1188,6 +1188,7 @@ trans_code (gfc_code * code, tree cond)
|
||||
{
|
||||
case EXEC_NOP:
|
||||
case EXEC_END_BLOCK:
|
||||
case EXEC_END_NESTED_BLOCK:
|
||||
case EXEC_END_PROCEDURE:
|
||||
res = NULL_TREE;
|
||||
break;
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
2011-08-18 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* gcc.dg/c1x-pointer-float-1.c: New test.
|
||||
|
14
gcc/testsuite/gfortran.dg/end_associate_label_1.f90
Normal file
14
gcc/testsuite/gfortran.dg/end_associate_label_1.f90
Normal file
@ -0,0 +1,14 @@
|
||||
! { dg-do compile }
|
||||
!
|
||||
! PR fortran/50071
|
||||
! A label in an END ASSOCIATE statement was ignored; as a result, a GOTO
|
||||
! to such a label was rejected.
|
||||
!
|
||||
! Contributed by Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
integer :: i
|
||||
associate (j => i)
|
||||
goto 1
|
||||
print *, 'Hello'
|
||||
1 end associate
|
||||
end
|
14
gcc/testsuite/gfortran.dg/end_block_label_1.f90
Normal file
14
gcc/testsuite/gfortran.dg/end_block_label_1.f90
Normal file
@ -0,0 +1,14 @@
|
||||
! { dg-do compile }
|
||||
!
|
||||
! PR fortran/50071
|
||||
! A label in an END BLOCK statement was ignored; as a result, a GOTO
|
||||
! to such a label was rejected.
|
||||
!
|
||||
! Contributed by Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
block
|
||||
goto 1
|
||||
print *, 'Hello'
|
||||
1 end block
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user