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

omp_display_env: Type mismatch

Dave_Allured
New Contributor II
2,683 Views

This looks like an internal error in the fortran interface in Intel's OpenMP library.  Please confirm or explain if I misunderstand something.  It is complaining about a C interface, but this demo is fortran only.

> ifx --version | grep ifx
ifx (IFX) 2025.1.1 20250418

> cat test_omp.f90
   use omp_lib
   call omp_display_env (verbose=.true.)
   end

> ifx -qopenmp test_omp.f90
test_omp.f90(2): warning #5472: When passing logicals to C, specify '-fpscomp logicals' to get the zero/non-zero behavior of FALSE/TRUE.
   call omp_display_env (verbose=.true.)
---------------------------------^

> ifx -qopenmp-stubs test_omp.f90
test_omp.f90(2): warning #5472: When passing logicals to C, specify '-fpscomp logicals' to get the zero/non-zero behavior of FALSE/TRUE.
   call omp_display_env (verbose=.true.)
---------------------------------^

 The fortran argument type is logical according to the OpenMP 6.0 spec.  Yes, adding -fpscomp logicals will suppress this warning.  However, that should not be necessary for a standard-conforming program.  I tested this with OneAPI 2025.1.1 because it will be a while before our managers install 2025.2.

Is this still occurring in 2025.2?  Can this be fixed for a future OneAPI release?

0 Kudos
3 Replies
Mark_Lewy
Valued Contributor I
1,579 Views

In module omp_lib, the interface to omp_display_env is

 

          subroutine omp_display_env(verbose) bind(c)
            use omp_lib_kinds
            logical (kind=omp_logical_kind), value :: verbose
          end subroutine omp_display_env

This has bind(c), which requires logicals to take the value 0 for .false. and non-zero for .true. (see Logical Data Representations).  Generally, you would use -standard-semantics (which includes -fpscomp logicals)  to allow the correct interoperability of logicals.

I can't imagine this is going to change.

0 Kudos
Dave_Allured
New Contributor II
879 Views

I can't imagine this is going to change.

Sorry, it DID change.  Previous Intel versions accepted fortran generic type logical:

    ifort 2021.10.0, ifort 2021.13.1, ifx 2024.2.1

OpenMP specs for 5.2 and 6.0 are precisely:

subroutine omp_display_env (verbose)
logical, intent(in) :: verbose

That is fortran type logical, not omp_logical_kind.  They are not the same.  Those OpenMP specs have no mention of omp_logical_kind.

From my viewpoint, the ifx 2025.1.1 interface for omp_display_env is off standard and should be changed back to match OpenMP specs.  I do not know what the larger interoperability issues are, but this routine should not be affected.

0 Kudos
Mark_Lewy
Valued Contributor I
513 Views

As far as I can tell, the interface to omp_display_env in Intel's implementation of module omp_lib has not changed between IFX 2024.2 and 2025.2. In any case, the definition of omp_logical_kind is 4, so is the same as a default logical.

My point was that Intel was unlikely to change the behaviour of the compiler to make "-fpscomp logicals" the default, not that the interface, as defined has changed, or is not compliant, with the OpenMP spec.

It appears that Intel added warning #5472 after 2024.2 was released. We normally use -standard-semantics in our builds, so hadn't noticed any changes.

 

program test_omp_display_env
    use omp_lib

    implicit none

    ! Variables

    ! Body of test_omp_display_env
    call omp_display_env(.true.)
end program test_omp_display_env
Rebuild started at 09:26...
1>------ Rebuild All started: Project: test_omp_display_env (IFX), Configuration: Debug x64 ------
Deleting intermediate files and output files for project 'test_omp_display_env', configuration 'Debug|x64'.
Compiling with Intel® Fortran Compiler 2024.2.1 [Intel(R) 64]...
test_omp_display_env.f90
Linking...
Embedding manifest...

Build log written to  "file://C:/Users/lewym/source/repos/test_omp_display_env/x64/Debug/BuildLog.htm"
test_omp_display_env - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 09:26 and took 00.941 seconds ==========
Rebuild started at 09:27...
1>------ Rebuild All started: Project: test_omp_display_env (IFX), Configuration: Debug x64 ------
Deleting intermediate files and output files for project 'test_omp_display_env', configuration 'Debug|x64'.
Compiling with Intel® Fortran Compiler 2025.2.1 [Intel(R) 64]...
test_omp_display_env.f90
C:\Users\lewym\source\repos\test_omp_display_env\test_omp_display_env.f90(9): warning #5472: When passing logicals to C, specify '/fpscomp:logicals' to get the zero/non-zero behavior of FALSE/TRUE.
Linking...
Embedding manifest...

Build log written to  "file://C:/Users/lewym/source/repos/test_omp_display_env/x64/Debug/BuildLog.htm"
test_omp_display_env - 0 error(s), 1 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 09:27 and took 01.013 seconds ==========

Command line options:

/nologo /debug:full /Od /Qopenmp /Qiopenmp /warn:interfaces /module:"x64\Debug\\" /object:"x64\Debug\\" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c

(I assume the change in behaviour applies to Linux too)

 

 

Reply