[flang-commits] [PATCH] D159028: [flang] Better error recovery when using erroneous procedures and pointers as intrinsic actual arguments
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Aug 29 08:20:47 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGad778a8a0ffd: [flang] Better error recovery when using erroneous procedures and pointers as… (authored by klausler).
Changed prior to commit:
https://reviews.llvm.org/D159028?vs=554077&id=554359#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159028/new/
https://reviews.llvm.org/D159028
Files:
flang/lib/Evaluate/intrinsics.cpp
flang/test/Semantics/associated.f90
Index: flang/test/Semantics/associated.f90
===================================================================
--- flang/test/Semantics/associated.f90
+++ flang/test/Semantics/associated.f90
@@ -70,6 +70,8 @@
procedure(subrInt), pointer :: subProcPointer
procedure(), pointer :: implicitProcPointer
procedure(subrCannotBeCalledfromImplicit), pointer :: cannotBeCalledfromImplicitPointer
+ !ERROR: 'neverdeclared' must be an abstract interface or a procedure with an explicit interface
+ procedure(neverDeclared), pointer :: badPointer
logical :: lVar
type(t1) :: t1x
type(t1), target :: t1xtarget
@@ -210,5 +212,10 @@
lvar = associated(intPointerArr, targetIntArr([2,1]))
!ERROR: TARGET= argument 'targetintcoarray[1_8]' may not have a vector subscript or coindexing
lvar = associated(intPointerVar1, targetIntCoarray[1])
+ !ERROR: 'neverdeclared' is not a procedure
+ !ERROR: Could not characterize intrinsic function actual argument 'badpointer'
+ !ERROR: 'neverdeclared' is not a procedure
+ !ERROR: Could not characterize intrinsic function actual argument 'badpointer'
+ lvar = associated(badPointer)
end subroutine test
end subroutine assoc
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -2320,18 +2320,18 @@
}
}
}
- auto dc{characteristics::DummyArgument::FromActual(
- std::move(kw), *expr, context)};
- if (!dc) {
- common::die("INTERNAL: could not characterize intrinsic function "
- "actual argument '%s'",
+ if (auto dc{characteristics::DummyArgument::FromActual(
+ std::move(kw), *expr, context)}) {
+ dummyArgs.emplace_back(std::move(*dc));
+ if (d.typePattern.kindCode == KindCode::same && !sameDummyArg) {
+ sameDummyArg = j;
+ }
+ } else { // error recovery
+ messages.Say(
+ "Could not characterize intrinsic function actual argument '%s'"_err_en_US,
expr->AsFortran().c_str());
return std::nullopt;
}
- dummyArgs.emplace_back(std::move(*dc));
- if (d.typePattern.kindCode == KindCode::same && !sameDummyArg) {
- sameDummyArg = j;
- }
} else {
CHECK(arg->GetAssumedTypeDummy());
dummyArgs.emplace_back(std::string{d.keyword},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159028.554359.patch
Type: text/x-patch
Size: 2522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230829/1cba3611/attachment-0001.bin>
More information about the flang-commits
mailing list