Skip to content
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: 3 additions & 0 deletions flang/lib/Semantics/check-deallocate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ void DeallocateChecker::Leave(const parser::DeallocateStmt &deallocateStmt) {
"Object in DEALLOCATE statement is not deallocatable"_err_en_US)
.Attach(std::move(
whyNot->set_severity(parser::Severity::Because)));
} else if (evaluate::ExtractCoarrayRef(*expr)) { // F'2023 C955
context_.Say(source,
"Component in DEALLOCATE statement may not be coindexed"_err_en_US);
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Semantics/deallocate05.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Program deallocatetest
Character(256) :: ee
Procedure(Real) :: prp

type at
real, allocatable :: a
end type
type(at) :: c[*]

Allocate(rp)
Deallocate(rp)

Expand Down Expand Up @@ -67,4 +72,7 @@ Program deallocatetest
!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
Deallocate(x, stat=s, errmsg=ee, errmsg=ee)

!ERROR: Component in DEALLOCATE statement may not be coindexed
deallocate(c[1]%a)

End Program deallocatetest