Skip to content

[flang] accept character type in fir::changeTypeShape #131892

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

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flang/lib/Optimizer/Dialect/FIRType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,8 @@ changeTypeShape(mlir::Type type,
})
.Default([&](mlir::Type t) -> mlir::Type {
assert((fir::isa_trivial(t) || llvm::isa<fir::RecordType>(t) ||
llvm::isa<mlir::NoneType>(t)) &&
llvm::isa<mlir::NoneType>(t) ||
llvm::isa<fir::CharacterType>(t)) &&
"unexpected FIR leaf type");
if (newShape)
return fir::SequenceType::get(*newShape, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ subroutine test_need_to_save_lhs_and_rhs(n, a)
! CHECK-NEXT: conflict: R/W
! CHECK-NEXT: run 1 save : forall/region_assign1/lhs
! CHECK-NEXT: run 2 evaluate: forall/region_assign1

subroutine test_character_no_conflict(c)
type tc
character(10), pointer :: p
end type
character(10), target :: c(10)
integer(8) :: i
type(tc) a(10)
forall(i=1:10)
a(i)%p => c(i)
end forall
end subroutine
! CHECK: ------------ scheduling forall in _QMforall_pointersPtest_character_no_conflict ------------
! CHECK-NEXT: run 1 evaluate: forall/region_assign1

end module

! End to end test provided for debugging purpose (not run by lit).
Expand Down