Skip to content

Inappropriate version comparison of Intel Fortran in CMakeLists.txt  #443

Open
@degawa

Description

@degawa
Contributor

To switch a compiler option for specifying the Fortran standard, CMake processes the following statements:

  add_compile_options(-warn declarations,general,usage,interfaces,unused)
  if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)
    add_compile_options(-stand f15)
  else()
    add_compile_options(-stand f18)
  endif()

The version comparison operator VERSION_LESS used here corresponds to <, so -stand f18 is specified for Intel Fortran 18.0 and later. However, Intel Fortran 18 does not have the keyword f18 for -stand option.
It can be confirmed from references:

I found a version comparison operator VERSION_LESS_EQUAL corresponding to <=.
It would be better to use it instead of VERSION_LESS.

  add_compile_options(-warn declarations,general,usage,interfaces,unused)
  if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL 18.0)
    add_compile_options(-stand f15)
  else()
    add_compile_options(-stand f18)
  endif()

Activity

awvwgk

awvwgk commented on Jun 25, 2021

@awvwgk
Member

Good catch, thanks. Would you mind opening a pull request for this?

nncarlson

nncarlson commented on Jun 25, 2021

@nncarlson
Contributor

Note that when CMake compares version strings it uses the full version, including the fourth tweak field, which for Intel is the numeric build date. And when you compare against "18.0" it is padded with 0's to "18.0.0.0". So even with VERSION_LESS_EQUAL, any 18.0 version compiler -- including 18.0.0 because of the build date for the tweak field -- will fall into the else clause. This needs to be VERSION_LESS 18.1 if 18.1 is the first to support -stand f18. Actually I think they went straight from 18.0 to 19.0, so VERSION_LESS 19.0 works.

Romendakil

Romendakil commented on Jun 25, 2021

@Romendakil

Recently there was the discussion in favor of not support gfortran 7 and 8 any longer because they are no longer maintained by gcc/gfortran. With the same reasoning, shouldn't we abandon Intel 18 and 19 as well as they are no longer supported (AFAIK). Intel 20 and 21 are the only actively maintained versions.

nncarlson

nncarlson commented on Jun 25, 2021

@nncarlson
Contributor

I wouldn't object too strongly to dropping support for at least Intel 18 -- it's pretty old now. Though it is still used in some HPC centers where they tend to keep their OS/software stack unchanged for a long time. I'm not aware of any 20 or 21 version. They seemed to have jumped from 19.1 to 2021 in their new oneAPI branding.

awvwgk

awvwgk commented on Jun 25, 2021

@awvwgk
Member

Well, stdlib doesn't compile with Intel 18 and lower anyway, so support is not really given right now for those versions (see #299).

degawa

degawa commented on Jun 27, 2021

@degawa
ContributorAuthor

Would the following be a summary of the discussion here?

  • Since stdlib no longer supports Intel Fortran 18 and 19, the statements if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)... will be removed in the near future (soon?).
  • Therefore, there is no need to fix them.
awvwgk

awvwgk commented on Jun 27, 2021

@awvwgk
Member

I found only one Intel 18 version that works (18.0.5 20180823), but I think going forward we will just drop support for 18 and earlier. Therefore, there is indeed no need to fix this issue.

added
compiler: ifortSpecific to Intel Fortran compilers
build: cmakeIssue with stdlib's CMake build files
and removed on Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbuild: cmakeIssue with stdlib's CMake build filescompiler: ifortSpecific to Intel Fortran compilerswontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nncarlson@degawa@Romendakil@awvwgk

        Issue actions

          Inappropriate version comparison of Intel Fortran in CMakeLists.txt · Issue #443 · fortran-lang/stdlib