Commit d51347f9 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/31472 (gfortran does not detect the illegal use of an access…

re PR fortran/31472 (gfortran does not detect the illegal use of an access specification in a program, subroutine, or function)

2007-04-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/31472
	* decl.c (match_attr_spec): Allow PRIVATE/PUBLIC
	attribute in type definitions.
	(gfc_match_private): Allow PRIVATE statement only
	in specification part of modules.
	(gfc_match_public): Ditto for PUBLIC.
	(gfc_match_derived_decl): Allow PRIVATE/PUBLIC attribute only in
	specificification part of modules.

2007-04-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/31472
	* gfortran.dg/access_spec_1.f90: New test.
	* gfortran.dg/access_spec_2.f90: New test.
	* gfortran.dg/non_module_public.f90: Match new error message.

From-SVN: r123735
parent 8c5e065b
2007-04-12 Tobias Burnus <burnus@net-b.de>
PR fortran/31472
* decl.c (match_attr_spec): Allow PRIVATE/PUBLIC
attribute in type definitions.
(gfc_match_private): Allow PRIVATE statement only
in specification part of modules.
(gfc_match_public): Ditto for PUBLIC.
(gfc_match_derived_decl): Allow PRIVATE/PUBLIC attribute only in
specificification part of modules.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31257
......
2007-04-12 Tobias Burnus <burnus@net-b.de>
PR fortran/31472
* gfortran.dg/access_spec_1.f90: New test.
* gfortran.dg/access_spec_2.f90: New test.
* gfortran.dg/non_module_public.f90: Match new error message.
2007-04-11 Paul Thomas <pault@gcc.gnu.org>
PR testsuite/31538
! { dg-do compile }
! PR fortran/31472
! Access specifications: Valid Fortran 2003 code
module mod
implicit none
private
integer, public :: i
integer, private :: z
integer :: j, x
private :: j
public :: x
type, public :: bar
PRIVATE
integer, public :: y ! Fortran 2003
integer, private :: z ! Fortran 2003
end type
end module
! { dg-final { cleanup-modules "mod" } }
! { dg-do compile }
! { dg-options "-std=f95" }
! PR fortran/31472
! Access specifications: Invalid Fortran 95 code
module test
implicit none
integer, public :: x
public :: x ! { dg-error "was already specified" }
private :: x ! { dg-error "was already specified" }
end module test
module mod
implicit none
private
type, public :: bar
PRIVATE
integer, public :: y ! { dg-error "Fortran 2003: Attribute PUBLIC" }
integer, public :: z ! { dg-error "Fortran 2003: Attribute PUBLIC" }
end type ! { dg-error "Derived type definition at" }
contains
subroutine foo
integer :: x
private :: x ! { dg-error "only allowed in the specification part of a module" }
type, private :: t ! { dg-error "only be PRIVATE in the specification part of a module" }
integer :: z
end type t ! { dg-error "Expecting END SUBROUTINE statement" }
type :: ttt
integer,public :: z ! { dg-error "not allowed outside of the specification part of a module" }
end type ttt ! { dg-error "Derived type definition at" }
end subroutine
end module
program x
implicit none
integer :: i
public :: i ! { dg-error "only allowed in the specification part of a module" }
integer,public :: j ! { dg-error "not allowed outside of the specification part of a module" }
end program x
! { dg-final { cleanup-modules "test mod" } }
! { dg-do compile }
! PR20837 - A symbol may not be declared PUBLIC or PRIVATE outside a module.
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
integer, parameter, public :: i=1 ! { dg-error "allowed outside of a MODULE" }
integer, parameter, public :: i=1 ! { dg-error "outside of the specification part of a module" }
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