-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:irgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributeopenmp
Description
@clementval reports that the location information for OpenMP constructs and clauses is incorrect.
In lowering, the getCurrentLocation
function is used. getCurrentLocation
refers to the location of the last Fortran construct. The same issue in OpenACC was fixed in https://reviews.llvm.org/D131659 using the genLocation
function. A similar approach could be used for OpenMP as well.
Reproducer
For the following Fortran OpenMP program,
$ cat openmp_loc.f90
subroutine sb(x,y)
integer :: x, y
!$omp parallel
x = y
!$omp end parallel
end subroutine
we get the following location information. As can be seen the location of the OpenMP construct is printed as loc1 (= line 1 column 1), this is incorrect.
$ ./bin/flang-new -fc1 -fopenmp -emit-fir -mmlir --mlir-print-debuginfo openmp_loc.f90 -o -
#loc1 = loc("./openmp_loc.f90":1:1)
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "aarch64-unknown-linux-gnu"} {
func.func @_QPsb(%arg0: !fir.ref<i32> {fir.bindc_name = "x"} loc("./openmp_loc.f90":1:1), %arg1: !fir.ref<i32> {fir.bindc_name = "y"} loc("./openmp_loc.f90":1:1)) {
omp.parallel {
%0 = fir.load %arg1 : !fir.ref<i32> loc(#loc2)
fir.store %0 to %arg0 : !fir.ref<i32> loc(#loc2)
omp.terminator loc(#loc1)
} loc(#loc1)
return loc(#loc3)
} loc(#loc1)
} loc(#loc0)
#loc0 = loc(unknown)
#loc2 = loc("./openmp_loc.f90":4:7)
#loc3 = loc("./openmp_loc.f90":6:1
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorflang:irgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributeopenmp