Skip to content

[Flang] [OpenMP] Do concurrent generate incorrect results when compared to the serial version #162256

@Thirumalai-Shaktivel

Description

@Thirumalai-Shaktivel

MRE:

program main
    integer, parameter :: V = 2048
    real(8) :: x(V), y(V)

    x = 100.0
    y = 200.0
    print *, cgdot(x, y, V)

contains
    function cgdot (x,y,N)
        integer :: N, i
        real(8) :: cgdot
        real(8), dimension(N) :: x, y
        cgdot=0.
        do concurrent(i=1:N)
            cgdot=cgdot+x(i)*y(i)
        enddo
        return
    end
end program

Problem:

$ flang -fopenmp -fdo-concurrent-to-openmp=host x.f90
$ ./a.out
 35780000.

Correct result

$ flang -fopenmp -fdo-concurrent-to-openmp=none x.f90
$ ./a.out
 40960000.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions