OpenMP* IF clause has side-effects

An OpenMP* IF clause expression must not have any side-effects.

The OpenMP* specification says it is unspecified whether, in what order, or how many times, any side-effects of the evaluation of the IF clause expressions occur. Therefore, the presence of an IF clause expression with side-effects renders the meaning of the program ambiguous. Programs that depend on implementation defined semantics may not port from implementation to implementation.

ID

Observation

Description

1

OpenMP usage error

The location of the illegal IF clause

Example


    real r
    integer i, j, mysub
    common /cc/ j
    r = 2.7
    j = 50
!$OMP PARALLEL DO SHARED(r) IF(mysub() .LT. j)
    do i = 1, 3
        call sub(r)
    end do
!$OMP END PARALLEL DO
    print *, r
    end

    function mysub()
        integer j, mysub
        common /cc/ j
        j = 100
        mysub = 75
    end function mysub

    subroutine sub(r)
        real r
        r = r + 9.8
    end subroutine sub
        

Copyright © 2010, Intel Corporation. All rights reserved.