aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/selected_logical_kind_1.f90
blob: 18d8dedd50ed2945b82eb4f10e4b80a5af5821e1 (plain)
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
! { dg-do run }

program selected
  implicit none

  integer, parameter :: k = max(1, selected_logical_kind(128))
  logical(kind=k) :: l

  ! This makes assumptions about the targets, but they are true
  ! for all targets that gfortran supports

  if (selected_logical_kind(1)  /= 1) STOP 1
  if (selected_logical_kind(8)  /= 1) STOP 2
  if (selected_logical_kind(9)  /= 2) STOP 3
  if (selected_logical_kind(16) /= 2) STOP 4
  if (selected_logical_kind(17) /= 4) STOP 5
  if (selected_logical_kind(32) /= 4) STOP 6
  if (selected_logical_kind(33) /= 8) STOP 7
  if (selected_logical_kind(64) /= 8) STOP 8

  ! This should not exist

  if (selected_logical_kind(17921) /= -1) STOP 9

  ! We test for a kind larger than 64 bits separately

  if (storage_size(l) /= 8 * k) STOP 10

end program