[flang-commits] [PATCH] D142752: [flang] Catch obscure error in defined assignment
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Jan 27 13:42:09 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG54912dd2fbbd: [flang] Catch obscure error in defined assignment (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142752/new/
https://reviews.llvm.org/D142752
Files:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/resolve65.f90
Index: flang/test/Semantics/resolve65.f90
===================================================================
--- flang/test/Semantics/resolve65.f90
+++ flang/test/Semantics/resolve65.f90
@@ -65,6 +65,18 @@
end
end interface
end
+ !ERROR: In defined assignment subroutine 's3', second dummy argument 'y' must not be a pointer
+ subroutine s3(x, y)
+ import t
+ type(t), intent(out) :: x
+ type(t), intent(in), pointer :: y
+ end
+ !ERROR: In defined assignment subroutine 's4', second dummy argument 'y' must not be an allocatable
+ subroutine s4(x, y)
+ import t
+ type(t), intent(out) :: x
+ type(t), intent(in), allocatable :: y
+ end
end interface
end
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -1565,6 +1565,12 @@
msg =
"In defined assignment subroutine '%s', second dummy"
" argument '%s' must have INTENT(IN) or VALUE attribute"_err_en_US;
+ } else if (dataObject->attrs.test(DummyDataObject::Attr::Pointer)) {
+ msg =
+ "In defined assignment subroutine '%s', second dummy argument '%s' must not be a pointer"_err_en_US;
+ } else if (dataObject->attrs.test(DummyDataObject::Attr::Allocatable)) {
+ msg =
+ "In defined assignment subroutine '%s', second dummy argument '%s' must not be an allocatable"_err_en_US;
}
} else {
DIE("pos must be 0 or 1");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142752.492896.patch
Type: text/x-patch
Size: 1605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230127/682da28a/attachment.bin>
More information about the flang-commits
mailing list