[flang-commits] [flang] [flang][OpenMP] Initialize allocatable members of derived types (PR #120295)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Fri Jan 10 09:29:11 PST 2025
================
@@ -165,8 +182,8 @@ bool DataSharingProcessor::needBarrier() {
// variables.
// Emit implicit barrier for linear clause. Maybe on somewhere else.
for (const semantics::Symbol *sym : allPrivatizedSymbols) {
- if (sym->test(semantics::Symbol::Flag::OmpFirstPrivate) &&
- sym->test(semantics::Symbol::Flag::OmpLastPrivate))
+ if (sym->test(semantics::Symbol::Flag::OmpLastPrivate) &&
+ (sym->test(semantics::Symbol::Flag::OmpFirstPrivate) || callsInitClone))
----------------
luporl wrote:
Because `FortranAInitializeClone` receives an extra argument, that is the original variable.
When `lastprivate` is used, the original variable is modified by one of the running threads. Without the barrier, another thread may still be using it to initialize its copy.
https://github.com/llvm/llvm-project/pull/120295
More information about the flang-commits
mailing list