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

OpenMP "atomic capture" problem

Alfredo
Beginner
1,636 Views

Hello,

the ifort compiler (version 13.1.0) refuses to compile the following code:

[fortran]

program t

  type b
    integer :: s
  end type b

  integer :: v
  type(b) :: x

  !$omp atomic capture
  v = x%s
  x%s = x%s+1
  !$omp end atomic

  stop
end program t

[/fortran]

giving the following error message:

t.f90(11): error #7926: This statement is not a valid OpenMP* ATOMIC update-statement.
v = x%s
--^
t.f90(12): error #8550: An OpenMP* ATOMIC capture-statement is expected
x%s = x%s+1
--^
t.f90(10): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
!$omp atomic capture
^
[ Aborting due to internal error. ]
compilation aborted for t.f90 (code 1)

As far as I can understand the OpenMP 3.1 standard, the code should be compliant and, in fact, it goes through gfortran 4.7 with no problems. Note that, even if I change the order of the two instructions in the atomic construct (i.e., the update first and the capture second) nothing changes.

Is this a compiler bug or am I missing something?

thanks,

alfredo

0 Kudos
3 Replies
Heinz_B_Intel
Employee
1,636 Views

I will escalate the issue to engineering.  Thanks for the small test case

0 Kudos
Heinz_B_Intel
Employee
1,636 Views

Hello Alfredo

this very problem has been reported before ( issue # DPD200233147) and gwill be fixed in a release later this year.

Heinz

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,636 Views

One of your runtime libraries migh have a function performing the (atomic) XCHGADD (the specific function name will vary with library). This might get you by. On Windows you have in kernel32 the function InterlockedExchangeAdd, Linux may have different module, same function, different function name.

Jim Dempsey

0 Kudos
Reply