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
5 changes: 4 additions & 1 deletion flang/lib/Semantics/pointer-assignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ bool PointerAssignmentChecker::CheckLeftHandSide(const SomeExpr &lhs) {
} else if (evaluate::IsAssumedRank(lhs)) {
Say("The left-hand side of a pointer assignment must not be an assumed-rank dummy argument"_err_en_US);
return false;
} else if (evaluate::ExtractCoarrayRef(lhs)) { // F'2023 C1027
Say("The left-hand side of a pointer assignment must not be coindexed"_err_en_US);
return false;
} else {
return true;
}
Expand All @@ -177,7 +180,7 @@ bool PointerAssignmentChecker::Check(const SomeExpr &rhs) {
Say("An array section with a vector subscript may not be a pointer target"_err_en_US);
return false;
}
if (ExtractCoarrayRef(rhs)) { // C1026
if (ExtractCoarrayRef(rhs)) { // F'2023 C1029
Say("A coindexed object may not be a pointer target"_err_en_US);
return false;
}
Expand Down
13 changes: 12 additions & 1 deletion flang/test/Semantics/assign02.f90
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,25 @@ function f2()
end
end

! C1026 (R1037) A data-target shall not be a coindexed object.
! F'2023 C1029 A data-target shall not be a coindexed object.
subroutine s10
real, target, save :: a[*]
real, pointer :: b
!ERROR: A coindexed object may not be a pointer target
b => a[1]
end

! F'2023 C1027 the LHS may not be coindexed
subroutine s11
type t
real, pointer :: p
end type
type(t), save :: ca[*]
real, target :: x
!ERROR: The left-hand side of a pointer assignment must not be coindexed
ca[1]%p => x
end

end

module m2
Expand Down