OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [namelist_33.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
!
3
! PR fortran/32876 - accepts private items in public NAMELISTs
4
!
5
! USE-associated types with private components may
6
! not be used in namelists -- anywhere.
7
!
8
MODULE types
9
  type :: tp4
10
    PRIVATE
11
    real :: x
12
    integer :: i
13
  end type
14
 
15
  ! nested type
16
  type :: tp3
17
    real :: x
18
    integer, private :: i
19
  end type
20
 
21
  type :: tp2
22
    type(tp3) :: t
23
  end type
24
 
25
  type :: tp1
26
    integer :: i
27
    type(tp2) :: t
28
  end type
29
END MODULE
30
 
31
MODULE nml
32
  USE types
33
 
34
  type(tp1) :: t1
35
  type(tp4) :: t4
36
 
37
  namelist /a/ t1          ! { dg-error "use-associated PRIVATE components" }
38
  namelist /b/ t4          ! { dg-error "use-associated PRIVATE components" }
39
 
40
  integer, private :: i
41
  namelist /c/ i           ! { dg-error "was declared PRIVATE and cannot be member of PUBLIC namelist" }
42
 
43
contains
44
  subroutine y()
45
   type(tp2) :: y2
46
   type(tp3) :: y3
47
 
48
    namelist /nml2/ y2     ! { dg-error "has use-associated PRIVATE components " }
49
    namelist /nml3/ y3     ! { dg-error "has use-associated PRIVATE components " }
50
  end subroutine
51
END MODULE
52
 
53
 
54
program xxx
55
  use types
56
 
57
  type :: tp5
58
    TYPE(tp4) :: t        ! nested private components
59
  end type
60
  type(tp5) :: t5
61
 
62
  namelist /nml/ t5       ! { dg-error "has use-associated PRIVATE components" }
63
 
64
contains
65
  subroutine z()
66
    namelist /nml2/ t5    ! { dg-error "has use-associated PRIVATE components" }
67
  end subroutine
68
end program
69
 
70
! { dg-final { cleanup-modules "types nml" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.