Skip to content

Conversation

@NimishMishra
Copy link
Contributor

This patch skips default privatization for crashing cases like namelists, reduction instrinsics, and structure constructor.

Fixes: #67332, #66454, and #65569

Co-Authored-By: kiranchandramohan kiran.chandramohan@arm.com

@llvmbot
Copy link
Member

llvmbot commented Nov 10, 2023

@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-fir-hlfir

Author: None (NimishMishra)

Changes

This patch skips default privatization for crashing cases like namelists, reduction instrinsics, and structure constructor.

Fixes: #67332, #66454, and #65569

Co-Authored-By: kiranchandramohan <kiran.chandramohan@arm.com>


Full diff: https://github.com/llvm/llvm-project/pull/71922.diff

1 Files Affected:

  • (modified) flang/lib/Lower/OpenMP.cpp (+4-1)
diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 945066549299d77..60db450d9be1508 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -483,7 +483,10 @@ void DataSharingProcessor::defaultPrivatize() {
   for (const Fortran::semantics::Symbol *sym : defaultSymbols) {
     if (!symbolsInNestedRegions.contains(sym) &&
         !symbolsInParentRegions.contains(sym) &&
-        !privatizedSymbols.contains(sym)) {
+        !privatizedSymbols.contains(sym) &&
+        !Fortran::semantics::IsProcedure(*sym) &&
+        !sym->GetUltimate().has<Fortran::semantics::DerivedTypeDetails>() &&
+        !sym->GetUltimate().has<Fortran::semantics::NamelistDetails>()) {
       cloneSymbol(sym);
       copyFirstPrivateSymbol(sym);
     }

@NimishMishra
Copy link
Contributor Author

Not adding HLFIR tests as of now because the default privatization for parallel do is currently not sound (refer #71915 and #71914). I'll add tests for namelists, structure constructors, and procedures in reduction() in the fix I send across for these issues.

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.

Could you add one test each for these conditions. Just check that the lowering pass, no need to check the IR in detail.

Comment on lines 487 to 489
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these checks to the beginning.

@NimishMishra NimishMishra merged commit c4d7321 into llvm:main Nov 10, 2023
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
…1922)

This patch skips default privatization for crashing cases like
namelists, reduction instrinsics, and structure constructor.

Fixes: llvm#67332,
llvm#66454, and
llvm#65569

Co-Authored-By: kiranchandramohan <kiran.chandramohan@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang:openmp flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flang][OpenMP][omp2012] Type confusion in reduction clause and fortran intrinsic

3 participants