-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[flang][OpenMP] Treat ClassType as BoxType in COPYPRIVATE #141844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][OpenMP] Treat ClassType as BoxType in COPYPRIVATE #141844
Conversation
This fixes the second problem reported in llvm#141481
@llvm/pr-subscribers-flang-fir-hlfir @llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesThis fixes the second problem reported in Full diff: https://github.com/llvm/llvm-project/pull/141844.diff 2 Files Affected:
diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index 885871698c946..afbc77d48cb53 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -743,6 +743,9 @@ void TypeInfo::typeScan(mlir::Type ty) {
} else if (auto bty = mlir::dyn_cast<fir::BoxType>(ty)) {
inBox = true;
typeScan(bty.getEleTy());
+ } else if (auto cty = mlir::dyn_cast<fir::ClassType>(ty)) {
+ inBox = true;
+ typeScan(cty.getEleTy());
} else if (auto cty = mlir::dyn_cast<fir::CharacterType>(ty)) {
charLen = cty.getLen();
} else if (auto hty = mlir::dyn_cast<fir::HeapType>(ty)) {
diff --git a/flang/test/Lower/OpenMP/copyprivate4.f90 b/flang/test/Lower/OpenMP/copyprivate4.f90
new file mode 100644
index 0000000000000..02fdbc71edc59
--- /dev/null
+++ b/flang/test/Lower/OpenMP/copyprivate4.f90
@@ -0,0 +1,18 @@
+!RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
+
+!The second testcase from https://github.com/llvm/llvm-project/issues/141481
+
+!Check that we don't crash on this.
+
+!CHECK: omp.single copyprivate(%6#0 -> @_copy_class_ptr_rec__QFf01Tt : !fir.ref<!fir.class<!fir.ptr<!fir.type<_QFf01Tt>>>>) {
+!CHECK: omp.terminator
+!CHECK: }
+
+subroutine f01
+ type t
+ end type
+ class(t), pointer :: tt
+
+!$omp single copyprivate(tt)
+!$omp end single
+end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG. Please wait for @luporl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix.
This fixes the second problem reported in #141481
This fixes the second problem reported in llvm#141481
This fixes the second problem reported in llvm#141481
This fixes the second problem reported in
#141481