Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29231 ディスカッション

Error in documentation of COMPILER_VERSION

mecej4
名誉コントリビューター III
1,334件の閲覧回数

The OneAPI Fortran compiler developer reference guide gives the following code to illustrate the usage of the intrinsic COMPILER_VERSION:

 

 

program pvers
use ISO_FORTRAN_ENV

character (len = :), allocatable :: res

res = compiler_version ()
print *, "len of res is: ", len (res)
print *, "('<<', A, '>>')", res

deallocate (res)
close (1)
end

 

 

On line-8, *, should not be present.  Line-11 does not belong, either.

7 返答(返信)
FortranFan
名誉コントリビューター III
1,304件の閲覧回数

Good catch @mecej4 .

 

Intel Team,

Can you please also review the following toward any update to the documentation?

  1. The two standard inquiry functions, COMPILER_VERSION and COMPILER_OPTIONS, go hand in hand.
  2. The information returned by the two functions is essentially a compile-time string constant, thus users may be better off defining a named constant of CHARACTER type toward the same rather than variables
  3. Thus an initial sketch of an example to be included in the documentation may be as follows that your writer(s) can edit as deemed suitable:
program CompilerVerandOptions
   use, intrinsic :: iso_fortran_env, only : compiler_version, compiler_options
   character(len=*), parameter :: cver = compiler_version()
   character(len=*), parameter :: copts = compiler_options()
   print *, "Compiler Version: ", cver
   print *, "Compiler Options: ", copts
end program 
C:\temp>ifort /standard-semantics CompilerVerandOptions.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.34.31937.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:CompilerVerandOptions.exe
-subsystem:console
CompilerVerandOptions.obj

C:\temp>CompilerVerandOptions.exe
 Compiler Version:
 Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel
 (R) 64, Version 2021.8.0 Build 20221119_000000
 Compiler Options: /standard-semantics

C:\temp>

 

 

 

JohnNichols
高評価コントリビューター III
1,298件の閲覧回数
program CompilerVerandOptions
   use, intrinsic :: iso_fortran_env, only : compiler_version, compiler_options
   character(len=*), parameter :: cver = compiler_version()
   character(len=*), parameter :: copts = compiler_options()
   write(*,100)cver
100 Format(   "Compiler Version: "//,(A),/)
   write(*,200)copts
200 Format(   "Compiler Options: "//,(A),//)
end program 

This gives you a bit cleaner output that is easier to read.  

Just of interest should not the use of Close(1) as noted by @mecej4  not generate a warning as the file was not opened.  

See below. 

Screenshot 2023-02-07 083904.png

Barbara_P_Intel
従業員
1,273件の閲覧回数

Definitely a GOOD CATCH! I filed a bug report, DOC-10851. The change might just make the next release.

I was in a meeting recently where the documentation team said they are planning to test the sample code in the DGRs (Developer Guide and Reference). That will be cool!



Barbara_P_Intel
従業員
1,271件の閲覧回数

Are you guys going to want royalties for these new examples? Best I can do is kudos. 

 

FortranFan
名誉コントリビューター III
1,251件の閲覧回数

@Barbara_P_Intel wrote:

Are you guys going to want royalties for these new examples? Best I can do is kudos. 


@Barbara_P_Intel ,

Yes, I would want royalties please!!!  In the form of more code examples with some real style by Intel writers in Fortran DRG for the benefit of oneAPI users!

JohnNichols
高評価コントリビューター III
1,226件の閲覧回数

I spotted a code error in the MS Powerstation Reference Manual, and then promptly lost it. 

It was write(*,))SOMETHING   Of course it is long past, but even the best make errors.  

 

Barbara_P_Intel
従業員
1,134件の閲覧回数

This is fixed the next release of oneAPI coming this spring.


返信