Commit 33344e0f by Janus Weil

re PR fortran/43244 (Invalid statement misinterpreted as FINAL declaration)

2010-03-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43244
	* decl.c (gfc_match_final_decl): Make sure variable names starting with
	'final...' are not misinterpreted as FINAL statements.


2010-03-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/43244
	* gfortran.dg/finalize_9.f90: New.

From-SVN: r157226
parent 9ca87236
2010-03-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/43244
* decl.c (gfc_match_final_decl): Make sure variable names starting with
'final...' are not misinterpreted as FINAL statements.
2010-03-03 Paul Thomas <pault@gcc.gnu.org> 2010-03-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43243 PR fortran/43243
......
...@@ -7810,8 +7810,18 @@ gfc_match_final_decl (void) ...@@ -7810,8 +7810,18 @@ gfc_match_final_decl (void)
bool first, last; bool first, last;
gfc_symbol* block; gfc_symbol* block;
if (gfc_current_form == FORM_FREE)
{
char c = gfc_peek_ascii_char ();
if (!gfc_is_whitespace (c) && c != ':')
return MATCH_NO;
}
if (gfc_state_stack->state != COMP_DERIVED_CONTAINS) if (gfc_state_stack->state != COMP_DERIVED_CONTAINS)
{ {
if (gfc_current_form == FORM_FIXED)
return MATCH_NO;
gfc_error ("FINAL declaration at %C must be inside a derived type " gfc_error ("FINAL declaration at %C must be inside a derived type "
"CONTAINS section"); "CONTAINS section");
return MATCH_ERROR; return MATCH_ERROR;
......
2010-03-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/43244
* gfortran.dg/finalize_9.f90: New.
2010-03-04 Tobias Burnus <burnus@net-b.de> 2010-03-04 Tobias Burnus <burnus@net-b.de>
Ken Werner <ken@linux.vnet.ibm.com> Ken Werner <ken@linux.vnet.ibm.com>
......
! { dg-do compile }
!
! PR 43244: Invalid statement misinterpreted as FINAL declaration
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
implicit none
type particle
integer :: ID
end type
type(particle), dimension(1,1:3) :: finalState
finalstate(1,(/1:2/))%ID = (/1,103/) ! { dg-error "Syntax error in array constructor" }
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