I have this old code
module foo
interface
subroutine bar(A)
!dir$ ignore_tkr(trd) A
DOUBLE COMPLEX, DIMENSION(*) :: A
end subroutine
end interface
end module foo
This is compiled fine by nvfortan and gfortran compilers. Yet, LLVM Flang cannot even parse it, because it doesn't know what d in the ignore_tkr means.
I assume, it means "ignore dimension". But I couldn't google anything up about it.
Could someone please send something to read about it and/or explain in details this thing?
Compiler directives are compiler specific. Note that for a standard Fortran compiler without any extensions they are just comments and will be ignored. The fact that it compiles with many compilers may just mean that those compilers ignore that directive altogether.
Some compilers will understand
other will understand
or
Gfortran, for example. has no obligation to understand directives specific to other compilers and will just ignore the directive you have shown.
For example, gfortran understand these directives https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-Compiler-Directives.html
For directives supported by Flang, consult the documentation https://releases.llvm.org/12.0.0/tools/flang/docs/Directives.html
Note that
!dir$ ignore_tkr (tkr) var-listis supported by Flang and will omit checking the type, kind and/or rank of arguments passed to the procedure.You specify the desired checks in the
(tkr). You use all oft,k, andrif you want to disable all three. The letterdis not among the possible letters to use and hence is erroneous. If you want to disable the checks for the number of dimensions of the array, userfor rank.Rank is the correct word that is used for the number of dimensions of an array in the Fortran standard.
The same syntax holds for nvfortran, see section 4.4 in https://docs.nvidia.com/hpc-sdk/archive/20.7/compilers/pdf/hpc207ref.pdf The only admissible parameters are
t,korr. No,dis not allowed. It does not mean anything in this context for these compilers.The programmer may have used
dinstead ofrinadvertently and the nvfortran compiler may ignore that or may even silently convert that tod. Such behaviour would only be specific to that compiler. I would just convert thedintorif it makes sense in that context.