Why no logical ==?

Ah. That is a nice approach. I was using a little program to probe a few compilers too.
Machines that distinguish between 0 and -0 might be an issue. I was just looking at what
switches might be available.

Without stooping to actually reading the manual, this little program tells a lot; I think I will merge it with yours and add a few asserts and add COMPILER_OPTIONS() for fun.

program curious
use, intrinsic :: iso_fortran_env, only: int16, compiler_version
implicit none
character(len=*), parameter :: all = '(*(g0,1x))'
integer :: i
integer, parameter :: pr = 20, sz = max(1024, pr)
integer :: ifew(-sz:sz) = [(i, i=-sz, sz)]
logical :: lfew(-sz:sz)
   print all, 'This file was compiled by ', compiler_version()
   lfew = transfer(ifew, [.true.])
   print all, count(lfew), '/', sz, transfer(.true., 255), transfer(.false., 255)
   print all, lfew(-pr:pr)
   ifew = transfer(lfew, [255])
   print all, ifew(-pr:pr)
end program curious
$ ifx curious.f90
$ ./a.out
This file was compiled by  Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2023.0.0 Build 20221201
1024 / 1024 -1 0
F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F
-20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
$ gfortran curious.f90
$ ./a.out
This file was compiled by  GCC version 11.1.0
2048 / 1024 1 0
T T T T T T T T T T T T T T T T T T T T F T T T T T T T T T T T T T T T T T T T T
-20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 Like