the ifort compiler (version 13.1.0) refuses to compile the following code:
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
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?