[Openmp-commits] [flang] [openmp] Changes to support link clause of declare target with common block (PR #84825)

Anchu Rajendran S via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 14 10:56:27 PDT 2024


================
@@ -1037,6 +1037,31 @@ static void genBodyOfTargetOp(
     genNestedEvaluations(converter, eval);
 }
 
+// If the symbol is specified in declare target directive, the function returns
+// the corresponding declare target operation.
+static mlir::omp::DeclareTargetInterface
+getDeclareTargetOp(const Fortran::semantics::Symbol &sym,
----------------
anchuraj wrote:

Thanks @agozillon . References to common block structure in llvm ir is not correct. It is not appropriately looking at the right index even for scalar. As you said, we will have to update the code generation to refer to the right index in the common block global.  
 ```
1 PROGRAM TEST
  2
  3 INTEGER A
  4 INTEGER CBA
  5 COMMON /C1/ A, CBA
  6
  7 !$OMP DECLARE TARGET LINK(/C1/)
  8
  9 A=2
 10 CBA=100
 11 !$OMP TARGET
 12 A=A+1
 13 CBA=CBA+1
 14 !$OMP END TARGET
 15 PRINT *, CBA
 16 END
```
The above code prints wrong result in case of scalars as indexing is not done properly. 
I am cancelling this PR and will try to solve this problem . 

https://github.com/llvm/llvm-project/pull/84825


More information about the Openmp-commits mailing list