Commit 73a014b5 by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/17708 (gfortran problem with goto inside loop)

fortran/
PR fortran/17708
* parse.c (accept_statement): Don't treat END DO like END IF and
END SELECT.
(parse_do_block): Generate possible END DO label inside END DO
block.

also, added ChangeLog entry for previous commit.

testsuite/
PR fortran/17708
* gfortran.dg/pr17708.f90: New test.

From-SVN: r88529
parent 95638988
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
* iresolve.c (gfc_resolve_mvbits): New function. * iresolve.c (gfc_resolve_mvbits): New function.
(gfc_resolve_random_number): Remove empty line at end of function. (gfc_resolve_random_number): Remove empty line at end of function.
* trans-const.c (gfc_build_cstring_const): New function.
(gfc_init_cst): Use new function.
* trans-const.h (gfc_build_cstring_const): Add prototype.
* trans-io.c (set_string, set_error_locus): Use new function.
* trans-stmt.c (gfc_trans_goto): Use new function.
PR fortran/17708
* parse.c (accept_statement): Don't treat END DO like END IF and
END SELECT.
(parse_do_block): Generate possible END DO label inside END DO
block.
2004-10-04 Erik Schnetter <schnetter@aei.mpg.de> 2004-10-04 Erik Schnetter <schnetter@aei.mpg.de>
* scanner.c (preprocessor_line): Accept preprocessor lines without * scanner.c (preprocessor_line): Accept preprocessor lines without
......
...@@ -1033,7 +1033,6 @@ accept_statement (gfc_statement st) ...@@ -1033,7 +1033,6 @@ accept_statement (gfc_statement st)
construct. */ construct. */
case ST_ENDIF: case ST_ENDIF:
case ST_ENDDO:
case ST_END_SELECT: case ST_END_SELECT:
if (gfc_statement_label != NULL) if (gfc_statement_label != NULL)
{ {
...@@ -2003,7 +2002,13 @@ loop: ...@@ -2003,7 +2002,13 @@ loop:
&& s.ext.end_do_label != gfc_statement_label) && s.ext.end_do_label != gfc_statement_label)
gfc_error_now gfc_error_now
("Statement label in ENDDO at %C doesn't match DO label"); ("Statement label in ENDDO at %C doesn't match DO label");
/* Fall through */
if (gfc_statement_label != NULL)
{
new_st.op = EXEC_NOP;
add_statement ();
}
break;
case ST_IMPLIED_ENDDO: case ST_IMPLIED_ENDDO:
break; break;
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
PR fortran/17631 PR fortran/17631
* gfortran.fortran-torture/execute/intrinsic_mvbits.f90: New test. * gfortran.fortran-torture/execute/intrinsic_mvbits.f90: New test.
PR fortran/17708
* gfortran.dg/pr17708.f90: New test.
2004-10-04 Chao-ying Fu <fu@mips.com> 2004-10-04 Chao-ying Fu <fu@mips.com>
* gcc.dg/vect/pr16105.c: Enable for mipsisa64*-*-*. * gcc.dg/vect/pr16105.c: Enable for mipsisa64*-*-*.
......
! { dg-do run }
program test
j = 0
do 10 i=1,3
if(i == 2) goto 10 ! { dg-warning "" "" }
j = j+1
10 enddo
if (j/=2) call abort
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment