aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/pointer-assignment.cpp
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2023-01-03 15:09:50 -0800
committerPeter Klausler <pklausler@nvidia.com>2023-02-01 12:12:43 -0800
commit50960e93833c821598044db131cf820edf6c6b3f (patch)
treef87cd47c6e5b9d2640440e474afa4eed738e7e92 /flang/lib/Semantics/pointer-assignment.cpp
parent3c1d0255d1788c607abb74ea0e775f1f753a9b94 (diff)
downloadllvm-50960e93833c821598044db131cf820edf6c6b3f.zip
llvm-50960e93833c821598044db131cf820edf6c6b3f.tar.gz
llvm-50960e93833c821598044db131cf820edf6c6b3f.tar.bz2
[flang] Catch character length errors in pointer associations
When character lengths are known at compilation time, report an error when a data target with a known length does not match the explicit length of a pointer that is being associated with it; see 10.2.2.3 paragraph 5. Differential Revision: https://reviews.llvm.org/D142755
Diffstat (limited to 'flang/lib/Semantics/pointer-assignment.cpp')
-rw-r--r--flang/lib/Semantics/pointer-assignment.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp
index a2e3497..86c6d9f 100644
--- a/flang/lib/Semantics/pointer-assignment.cpp
+++ b/flang/lib/Semantics/pointer-assignment.cpp
@@ -252,7 +252,7 @@ bool PointerAssignmentChecker::Check(const evaluate::Designator<T> &d) {
" derived type when target is unlimited polymorphic"_err_en_US;
}
} else {
- if (!lhsType_->type().IsTkCompatibleWith(rhsType->type())) {
+ if (!lhsType_->type().IsTkLenCompatibleWith(rhsType->type())) {
msg = MessageFormattedText{
"Target type %s is not compatible with pointer type %s"_err_en_US,
rhsType->type().AsFortran(), lhsType_->type().AsFortran()};