namelist_33.f90: Improved tests, adjusted error messages.
2007-08-07 Daniel Franke <franke.daniel@gmail.com> * gfortran.dg/namelist_33.f90: Improved tests, adjusted error messages. * gfortran.dg/namelist_36.f90: New test. From-SVN: r127268
This commit is contained in:
parent
6268a9a863
commit
d2b8fb9e46
|
@ -1,3 +1,9 @@
|
|||
2007-08-07 Daniel Franke <franke.daniel@gmail.com>
|
||||
|
||||
* gfortran.dg/namelist_33.f90: Improved tests, adjusted error
|
||||
messages.
|
||||
* gfortran.dg/namelist_36.f90: New test.
|
||||
|
||||
2007-08-07 Rask Ingemann Lambertsen <rask@sygehus.dk>
|
||||
|
||||
* gcc.c-torture/execute/simd-4.c (__ev_convert_s64)(main): Use
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
!
|
||||
! PR fortran/32876 - accepts private items in public NAMELISTs
|
||||
!
|
||||
! USE-associated types with private components may
|
||||
! not be used in namelists -- anywhere.
|
||||
!
|
||||
MODULE types
|
||||
type :: tp4
|
||||
PRIVATE
|
||||
|
@ -26,15 +29,42 @@ MODULE types
|
|||
END MODULE
|
||||
|
||||
MODULE nml
|
||||
USE types
|
||||
type(tp1) :: t1
|
||||
type(tp4) :: t4
|
||||
USE types
|
||||
|
||||
namelist /a/ t1 ! { dg-error "has PRIVATE components and cannot be a member of PUBLIC namelist" }
|
||||
namelist /b/ t4 ! { dg-error "has PRIVATE components and cannot be a member of PUBLIC namelist" }
|
||||
type(tp1) :: t1
|
||||
type(tp4) :: t4
|
||||
|
||||
namelist /a/ t1 ! { dg-error "use-associated PRIVATE components" }
|
||||
namelist /b/ t4 ! { dg-error "use-associated PRIVATE components" }
|
||||
|
||||
integer, private :: i
|
||||
namelist /c/ i ! { dg-error "was declared PRIVATE and cannot be member of PUBLIC namelist" }
|
||||
namelist /c/ i ! { dg-error "was declared PRIVATE and cannot be member of PUBLIC namelist" }
|
||||
|
||||
contains
|
||||
subroutine y()
|
||||
type(tp2) :: y2
|
||||
type(tp3) :: y3
|
||||
|
||||
namelist /nml2/ y2 ! { dg-error "has use-associated PRIVATE components " }
|
||||
namelist /nml3/ y3 ! { dg-error "has use-associated PRIVATE components " }
|
||||
end subroutine
|
||||
END MODULE
|
||||
|
||||
|
||||
program xxx
|
||||
use types
|
||||
|
||||
type :: tp5
|
||||
TYPE(tp4) :: t ! nested private components
|
||||
end type
|
||||
type(tp5) :: t5
|
||||
|
||||
namelist /nml/ t5 ! { dg-error "has use-associated PRIVATE components" }
|
||||
|
||||
contains
|
||||
subroutine z()
|
||||
namelist /nml2/ t5 ! { dg-error "has use-associated PRIVATE components" }
|
||||
end subroutine
|
||||
end program
|
||||
|
||||
! { dg-final { cleanup-modules "types nml" } }
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
! { dg-compile }
|
||||
!
|
||||
! Private types and types with private components
|
||||
! are acceptable in local namelists.
|
||||
!
|
||||
|
||||
MODULE nml
|
||||
type :: tp1
|
||||
integer :: i
|
||||
end type
|
||||
|
||||
type :: tp2
|
||||
private
|
||||
integer :: i
|
||||
end type
|
||||
|
||||
private :: tp1
|
||||
contains
|
||||
subroutine x()
|
||||
type(tp1) :: t1
|
||||
type(tp2) :: t2
|
||||
|
||||
namelist /nml1/ i ! ok, private variable
|
||||
namelist /nml2/ t1 ! ok, private type
|
||||
namelist /nml3/ t2 ! ok, private components
|
||||
end subroutine
|
||||
END MODULE
|
||||
|
||||
! { dg-final { cleanup-modules "nml" } }
|
Loading…
Reference in New Issue