2 ! { dg-require-visibility "" }
4 ! Checks that PRIVATE enities are visible to submodules.
6 ! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it>
9 integer, parameter :: ndig=8
10 integer, parameter :: ipk_ = selected_int_kind(ndig)
11 integer, parameter :: longndig=12
12 integer, parameter :: long_int_k_ = selected_int_kind(longndig)
13 integer, parameter :: mpik_ = kind(1)
15 integer(ipk_), parameter, public :: success_=0
23 integer(ipk_), parameter, public :: act_ret_=0
24 integer(ipk_), parameter, public :: act_print_=1
25 integer(ipk_), parameter, public :: act_abort_=2
27 integer(ipk_), parameter, public :: no_err_ = 0
29 public error, errcomm, get_numerr, &
31 & ser_error_handler, par_error_handler
34 interface error_handler
35 module subroutine ser_error_handler(err_act)
36 integer(ipk_), intent(inout) :: err_act
37 end subroutine ser_error_handler
38 module subroutine par_error_handler(ictxt,err_act)
39 integer(mpik_), intent(in) :: ictxt
40 integer(ipk_), intent(in) :: err_act
41 end subroutine par_error_handler
45 module subroutine serror()
47 module subroutine perror(ictxt,abrt)
48 integer(mpik_), intent(in) :: ictxt
49 logical, intent(in), optional :: abrt
54 interface error_print_stack
55 module subroutine par_error_print_stack(ictxt)
56 integer(mpik_), intent(in) :: ictxt
57 end subroutine par_error_print_stack
58 module subroutine ser_error_print_stack()
59 end subroutine ser_error_print_stack
63 module subroutine errcomm(ictxt, err)
64 integer(mpik_), intent(in) :: ictxt
65 integer(ipk_), intent(inout):: err
66 end subroutine errcomm
74 integer(ipk_) :: err_code=0
75 character(len=20) :: routine=''
76 integer(ipk_),dimension(5) :: i_err_data=0
77 character(len=40) :: a_err_data=''
78 type(errstack_node), pointer :: next
80 end type errstack_node
84 type(errstack_node), pointer :: top => null()
85 integer(ipk_) :: n_elems=0
89 type(errstack), save :: error_stack
90 integer(ipk_), save :: error_status = no_err_
91 integer(ipk_), save :: verbosity_level = 1
92 integer(ipk_), save :: err_action = act_abort_
93 integer(ipk_), save :: debug_level = 0, debug_unit, serial_debug_level=0
98 submodule (error_mod) error_impl_mod
101 ! checks whether an error has occurred on one of the processes in the execution pool
102 subroutine errcomm(ictxt, err)
103 integer(mpik_), intent(in) :: ictxt
104 integer(ipk_), intent(inout):: err
107 end subroutine errcomm
109 subroutine ser_error_handler(err_act)
111 integer(ipk_), intent(inout) :: err_act
113 if (err_act /= act_ret_) &
115 if (err_act == act_abort_) stop
118 end subroutine ser_error_handler
120 subroutine par_error_handler(ictxt,err_act)
122 integer(mpik_), intent(in) :: ictxt
123 integer(ipk_), intent(in) :: err_act
125 if (err_act == act_print_) &
126 & call error(ictxt, abrt=.false.)
127 if (err_act == act_abort_) &
128 & call error(ictxt, abrt=.true.)
132 end subroutine par_error_handler
134 subroutine par_error_print_stack(ictxt)
135 integer(mpik_), intent(in) :: ictxt
137 call error(ictxt, abrt=.false.)
139 end subroutine par_error_print_stack
141 subroutine ser_error_print_stack()
144 end subroutine ser_error_print_stack
150 end subroutine serror
152 subroutine perror(ictxt,abrt)
155 integer(mpik_), intent(in) :: ictxt
156 logical, intent(in), optional :: abrt
158 end subroutine perror
160 end submodule error_impl_mod
170 ! { dg-final { cleanup-submodules "error_mod@error_impl_mod" } }