I run across the non-standard use of logicals as integers often, and the extensions vary widely between compilers (even vintages of the same compiler family). Any chance f202x will define this behavior? Making it illegal without the use of an extension flag would be fine by me; but with C interops appearing in more and more codes allowing INT() to take a logical seems reasonable.

Recent versions of gfortran are much stricter than in the past and the usage between compilers varies so much I find myself using overloads to â€śstandardizeâ€ť the usage, which is not ideal (it is not always possible to change others code when I just want to use another compiler for various reasons).

The current state is all over the map. Run this with a few different compilers, for starters:

#### logicals.F90

```
program logicals
!! What happens when variables of one type are assigned to another type
implicit none
logical :: y, z
integer :: i, j
y=-0
if(y) error stop '0 should be False'
y=0
if(y) error stop '0 should be False'
y=-1
if(.not.y) error stop '-1 should be True'
print *,'0 and -1 seem to be standardized by convention, nothing else'
do i=-10,10
z=i
j=z
print *, i, z, j
enddo
print *,'even less predictable'
#ifdef __NVCOMPILER
print *, 'nvfortran: even FALSE odd TRUE, integers round-trip'
print *, 'z+z=',z+z,'logical or integer?'
print *, 'int(z):',int(z)
print *, 'int(z+z)=',int(z+z)
j=z+z
print *, 'z+z==j=',j
print *, z.eq.z,z.gt.y,z.lt.y
#endif
#ifdef __INTEL_COMPILER
print *, 'ifort: even FALSE odd TRUE, integers are 0 or -1'
print *, 'z+z=',z+z,'logical or integer?'
j=z+z
print *, 'z+z==j=',j
print *, z.eq.z,z.gt.y,z.lt.y
#endif
#ifdef __GFORTRAN__
print *, 'gfortran: 0 is FALSE, everything else is TRUE'
#endif
end program logicals
```

## gfortran

0 and -1 seem to be standardized by convention, nothing else

-10 T 1

-9 T 1

-8 T 1

-7 T 1

-6 T 1

-5 T 1

-4 T 1

-3 T 1

-2 T 1

-1 T 1

0 F 0

1 T 1

2 T 1

3 T 1

4 T 1

5 T 1

6 T 1

7 T 1

8 T 1

9 T 1

10 T 1

even less predictable

gfortran: 0 is FALSE, everything else is TRUE

## ifort

0 and -1 seem to be standardized by convention, nothing else

-10 F 0

-9 T -1

-8 F 0

-7 T -1

-6 F 0

-5 T -1

-4 F 0

-3 T -1

-2 F 0

-1 T -1

0 F 0

1 T -1

2 F 0

3 T -1

4 F 0

5 T -1

6 F 0

7 T -1

8 F 0

9 T -1

10 F 0

even less predictable

ifort: even FALSE odd TRUE, integers are 0 or -1

z+z= F logical or integer?

z+z==j= 0

T T F

## nvfortran

0 and -1 seem to be standardized by convention, nothing else

-10 F -10

-9 T -9

-8 F -8

-7 T -7

-6 F -6

-5 T -5

-4 F -4

-3 T -3

-2 F -2

-1 T -1

0 F 0

1 T 1

2 F 2

3 T 3

4 F 4

5 T 5

6 F 6

7 T 7

8 F 8

9 T 9

10 F 10

even less predictable

nvfortran: even FALSE odd TRUE, integers round-trip

z+z= 20 logical or integer?

int(z): 10

int(z+z)= 20

z+z==j= 20

T T F