Would it be useful for this module to also provide compile-time constants of compiler version and options used to build it?
module m
use iso_fortran_env, only: compiler_version, compiler_options
character(*), parameter :: stdlib_compiler_version = compiler_version()
character(*), parameter :: stdlib_compiler_options = compiler_options()
end module m
program p
use m
print *, stdlib_compiler_version
print *, stdlib_compiler_options
end
It works nicely with GFortran, but ifort 2021.3.0 doesn't seem to allow these intrinsic in constant expressions:
$ ifort test.f90
test.f90(3): error #6263: This intrinsic function is invalid in constant expressions. [COMPILER_VERSION]
character(*), parameter :: stdlib_compiler_version = compiler_version()
-------------------------------------------------------^
test.f90(4): error #6263: This intrinsic function is invalid in constant expressions. [COMPILER_OPTIONS]
character(*), parameter :: stdlib_compiler_options = compiler_options()
-------------------------------------------------------^
test.f90(8): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [M]
use m
------^
compilation aborted for test.f90 (code 1)
which I think is incorrect. Anyhow, just an idea, something we could tackle in another PR.
Would it be useful for this module to also provide compile-time constants of compiler version and options used to build it?
It works nicely with GFortran, but ifort 2021.3.0 doesn't seem to allow these intrinsic in constant expressions:
which I think is incorrect. Anyhow, just an idea, something we could tackle in another PR.
Originally posted by @milancurcic in https://github.com/fortran-lang/stdlib/pull/579#pullrequestreview-817149743