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
This commit is contained in:
Janus Weil 2010-03-04 14:42:06 +01:00
parent 9ca872365c
commit 33344e0feb
4 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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>
PR fortran/43243

View File

@ -7810,8 +7810,18 @@ gfc_match_final_decl (void)
bool first, last;
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_current_form == FORM_FIXED)
return MATCH_NO;
gfc_error ("FINAL declaration at %C must be inside a derived type "
"CONTAINS section");
return MATCH_ERROR;

View File

@ -1,3 +1,8 @@
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>
Ken Werner <ken@linux.vnet.ibm.com>

View File

@ -0,0 +1,13 @@
! { 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