File: iso_fortran_env_7.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (61 lines) | stat: -rw-r--r-- 1,631 bytes parent folder | download | duplicates (6)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
! { dg-do link }
!
! PR fortran/40571
!
! This test case adds check for the new Fortran 2008 array parameters
! in ISO_FORTRAN_ENV: integer_kinds, logical_kinds, character_kinds,
! and real_kinds.
!
! The test thus also checks that the values of the parameter are used
! and no copy is made. (Cf. PR 44856.)

program test
  use iso_fortran_env, only: integer_kinds, character_kinds
  implicit none
  integer :: aaaa(2),i
  i=1

  print *, integer_kinds
  print *, integer_kinds(1)
  print *, (integer_kinds)
  print *, (integer_kinds + 1)
  print *, integer_kinds(1:2)
  print *, integer_kinds(i)

  aaaa = character_kinds
  aaaa(1:2) = character_kinds(1:2)
  aaaa(i) = character_kinds(i)
  aaaa = character_kinds + 0
  aaaa(1:2) = character_kinds(1:2) + 0
  aaaa(i) = character_kinds(i) + 0
end program test

subroutine one()
  use iso_fortran_env, only: ik => integer_kinds, ik2 => integer_kinds
  implicit none

  if (any (ik /= ik2)) call never_call_me()
end subroutine one

subroutine two()
  use iso_fortran_env
  implicit none

  ! Should be 1, 2, 4, 8 and possibly 16
  if (size (integer_kinds) < 4) call never_call_me()
  if (any (integer_kinds(1:4) /= [1,2,4,8])) call never_call_me()
  if (any (integer_kinds /= logical_kinds)) call never_call_me()

  if (size (character_kinds) /= 2) call never_call_me()
  if (any (character_kinds /= [1,4])) call never_call_me()

  if (size (real_kinds) < 2) call never_call_me()
  if (any (real_kinds(1:2) /= [4,8])) call never_call_me()
end subroutine two

subroutine three()
  use iso_fortran_env
  integer :: i, j(2)
  i = real_kinds(1)
  j = real_kinds(1:2)
end subroutine three