File: modules_71.f90

package info (click to toggle)
lfortran 0.61.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 61,892 kB
  • sloc: cpp: 181,767; f90: 92,175; python: 17,616; ansic: 10,170; yacc: 2,377; sh: 1,444; fortran: 892; makefile: 38; javascript: 15
file content (32 lines) | stat: -rw-r--r-- 811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
! Test re-export of use-associated symbols with private default.
! Symbols imported via `use` and explicitly made `public` must be
! visible when the re-exporting module is itself `use`d.

module modules_71_kinds
  use iso_fortran_env, only: int8, int32
  implicit none
  private
  public :: int8, int32
end module modules_71_kinds

module modules_71_util
  use modules_71_kinds
  implicit none
contains
  subroutine set_first(a, val)
    integer(int8), intent(inout) :: a(:)
    integer(int32), intent(in) :: val
    a(1) = int(val, int8)
  end subroutine
end module modules_71_util

program modules_71
  use modules_71_util
  implicit none
  integer(1) :: x(3)
  x = [1, 2, 3]
  call set_first(x, 42)
  if (x(1) /= 42) error stop
  if (x(2) /= 2) error stop
  if (x(3) /= 3) error stop
end program modules_71