The situation with the current standard as well as the next revision is indeed inadequate in that the standard does not allow the practitioner to perform a suitable inquiry into the options supported by the processor. Thus the practitioner is left to do that separately a priori and then proceed with the program.
use, intrinsic :: iso_fortran_env, only : lk => logical_kinds
block
print *, "Supported logical_kinds: ", lk
end block
block
integer, parameter :: lk1 = lk(1), lk2 = lk(2), lk3 = lk(3), lk4 = lk(4)
print *, "storage size lk1: ", storage_size(.true._lk1)
print *, "storage size lk2: ", storage_size(.true._lk2)
print *, "storage size lk3: ", storage_size(.true._lk3)
print *, "storage size lk4: ", storage_size(.true._lk4)
end block
end
C:\temp>gfortran p.f90 -o p.exe
C:\temp>p.exe
Supported logical_kinds: 1 2 4 8 16
storage size lk1: 8
storage size lk2: 16
storage size lk3: 32
storage size lk4: 64