Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28496 Discussions

Error in documentation of COMPILER_VERSION

mecej4
Honored Contributor III
752 Views

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 Replies
FortranFan
Honored Contributor II
722 Views

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
Valued Contributor III
716 Views
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
Moderator
691 Views

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!



0 Kudos
Barbara_P_Intel
Moderator
689 Views

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

 

0 Kudos
FortranFan
Honored Contributor II
669 Views

@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!

0 Kudos
JohnNichols
Valued Contributor III
644 Views

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.  

 

0 Kudos
Barbara_P_Intel
Moderator
552 Views

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


0 Kudos
Reply