Commit 438e1428 by Tobias Schlüter

gfortran.h (gfc_namespace): Add seen_implicit_none field.

fortran/
	* gfortran.h (gfc_namespace): Add seen_implicit_none field.
	* symbol.c (gfc_set_implicit_none): Give error if there's a previous
	IMPLICIT NONE, set seen_implicit_none.
	(gfc_merge_new_implicit): Error if there's an IMPLICIT NONE statement.
testsuite/
	* gfortran.dg/implicit_4.f90: New test.

From-SVN: r98952
parent dd2778f3
2005-04-29 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_namespace): Add seen_implicit_none field.
* symbol.c (gfc_set_implicit_none): Give error if there's a previous
IMPLICIT NONE, set seen_implicit_none.
(gfc_merge_new_implicit): Error if there's an IMPLICIT NONE statement.
2005-04-28 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> 2005-04-28 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_gsymbol): Make name a const char *. * gfortran.h (gfc_gsymbol): Make name a const char *.
......
...@@ -106,6 +106,14 @@ gfc_set_implicit_none (void) ...@@ -106,6 +106,14 @@ gfc_set_implicit_none (void)
{ {
int i; int i;
if (gfc_current_ns->seen_implicit_none)
{
gfc_error ("Duplicate IMPLICIT NONE statement at %C");
return;
}
gfc_current_ns->seen_implicit_none = 1;
for (i = 0; i < GFC_LETTERS; i++) for (i = 0; i < GFC_LETTERS; i++)
{ {
gfc_clear_ts (&gfc_current_ns->default_type[i]); gfc_clear_ts (&gfc_current_ns->default_type[i]);
...@@ -160,6 +168,12 @@ gfc_merge_new_implicit (gfc_typespec * ts) ...@@ -160,6 +168,12 @@ gfc_merge_new_implicit (gfc_typespec * ts)
{ {
int i; int i;
if (gfc_current_ns->seen_implicit_none)
{
gfc_error ("Cannot specify IMPLICIT at %C after IMPLICIT NONE");
return FAILURE;
}
for (i = 0; i < GFC_LETTERS; i++) for (i = 0; i < GFC_LETTERS; i++)
{ {
if (new_flag[i]) if (new_flag[i])
......
2004-04-28 Bob Wilson <bob.wilson@acm.org> 2005-04-29 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/implicit_4.f90: New test.
2005-04-28 Bob Wilson <bob.wilson@acm.org>
* lib/target-supports.exp (check_profiling_available): Return * lib/target-supports.exp (check_profiling_available): Return
false for xtensa-*-elf. false for xtensa-*-elf.
2004-04-29 David Billinghurst (David.Billinghurst@riotinto.com) 2005-04-29 David Billinghurst (David.Billinghurst@riotinto.com)
* lib/fortran-torture.exp (fortran-torture.exp): Catch * lib/fortran-torture.exp (fortran-torture.exp): Catch
error if file cannot be deleted. error if file cannot be deleted.
......
! { dg-do compile }
! Verify error diagnosis for invalid combinations of IMPLICIT statements
IMPLICIT NONE
IMPLICIT NONE ! { dg-error "Duplicate" }
END
SUBROUTINE a
IMPLICIT REAL(b-j) ! { dg-error "cannot follow" }
implicit none ! { dg-error "cannot follow" }
END SUBROUTINE a
subroutine b
implicit none
implicit real(g-k) ! { dg-error "Cannot specify" }
end subroutine b
subroutine c
implicit real(a-b)
implicit integer (b-c) ! { dg-error "already" }
implicit real(d-f), complex(f-g) ! { dg-error "already" }
end subroutine c
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