Skip to content

[flang][debug] Improve handling of cyclic derived types with classes. #129588

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 4, 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 @@ -210,7 +210,8 @@ mlir::Type getDerivedType(mlir::Type ty) {
return seq.getEleTy();
return p.getEleTy();
})
.Case<fir::BoxType>([](auto p) { return getDerivedType(p.getEleTy()); })
.Case<fir::BaseBoxType>(
[](auto p) { return getDerivedType(p.getEleTy()); })
.Default([](mlir::Type t) { return t; });
}

Expand Down
22 changes: 22 additions & 0 deletions flang/test/Integration/debug-cyclic-derived-type-4.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s

! Same as debug-cyclic-derived-type-2.f90 but using class instead of type.
module m
type t2
class(t1), pointer :: p1
end type
type t1
class(t2), pointer :: p2
integer abc
end type
type(t1) :: tee1
end module

program test
use m
type(t2) :: lc2
print *, lc2%p1%abc
end program test

! CHECK-DAG: DICompositeType(tag: DW_TAG_structure_type, name: "t1"{{.*}})
! CHECK-DAG: DICompositeType(tag: DW_TAG_structure_type, name: "t2"{{.*}})