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

Conditional compile issue

jimdempseyatthecove
Honored Contributor III
60 Views

I have a (low priority) strange compilation issue observable in ifort and ifx

I have an OpenMP threaded program that builds a Debug build without OpenMP

 

When compiling Debug (without OpenMP) the following statement

!$  integer(kind=omp_lock_kind) :: lockOK

Is expanded and I get an error as omp_lock_kind is undefined

However, if I change the statement to

  !$integer(kind=omp_lock_kind) :: lockOK

Note leading whitespace.

Both compilers treat this as a comment.

The actual code (with error) compiles with fpp

 

My attempt at a reproducer does not exhibit the issue

module foo
    type abc
        integer :: dontcare
!$      integer(kind=omp_lock_kind) :: lock
    end type abc
end module foo
    
program Console24
    use foo
    implicit none
    type(abc) :: X
!$  integer(kind=omp_lock_kind) :: lockOK
end program Console24

As you do not have a simple reproducer, I don't expect you to work on this.

However, keep this in mind such that you can recommend an easy work around to others that experience the same.

 

FWIW the Solution exhibiting this error, has in other projects the use of

!$  **bleep**

and treating statement as comment

 

I am unsure as to what triggers this behavior

 

Jim Dempsey

0 Kudos
0 Replies
Reply