program test
implicit none
if (foo()) then
write (*,*) 'True'
else
write (*,*) 'False'
end if
contains
logical function foo()
foo = -1
end function foo
end program test
was not detected by Intel. We should never really allow a logical to be set to an integer. By default though:
$ ifort test.F90 && ./a.out
True
If we turn on -stand:
$ ifort -stand f18 test.F90 && ./a.out
test.F90(13): warning #6192: Fortran 2018 does not allow this data type conversion.
foo = -1
---------------^
True
Better but only a warning. Let's turn that to an error:
$ ifort -stand f18 -diag-error=6192 test.F90 && ./a.out
test.F90(13): error #6192: Fortran 2018 does not allow this data type conversion.
foo = -1
---------------^
compilation aborted for test.F90 (code 1)
@tclune found a case where something like this:
was not detected by Intel. We should never really allow a logical to be set to an integer. By default though:
If we turn on
-stand
:Better but only a warning. Let's turn that to an error:
There we go.