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

Why doesn't this work?

styc
Beginner
562 Views
I have this program:

[fortran]program test

    integer i

    !$omp parallel private(i)
    !$omp single
    do i = 1, 16
        call f(i)
    end do
    !$omp end single nowait
    !$omp end parallel

    contains

    subroutine f(x)

        integer :: x

        !$omp task firstprivate(x)
        print *, x
        !$omp end task

    end subroutine

end program
[/fortran]

With gfortran 4.4, I can see a permutation of 1 thru 16. But with ifort 12.1.{01}, I see a lot of other values.
0 Kudos
3 Replies
Udit_P_Intel
Employee
562 Views
I believe this may be a bug in the compiler. The TASK construct is a new OpenMP* 3.0 feature and may be erroneous here. If I replace the function call f(i) with an explicit print statement surrounded by a TASK construct, then the correct values are printed.
What do the OpenMP* experts on this forum think?

Best!
-Udit
0 Kudos
Ron_Green
Moderator
562 Views
looks like a bug to me. This appears to be a standard sample, I found the same code in C on the internet.

I'll start a bug report.

BUG id DPD200176160

ron
0 Kudos
Ron_Green
Moderator
562 Views
Just to close this out - this bug has been fixed in the most recent 12.1 updates ( Updates 10 and 9)

ron
0 Kudos
Reply