[PATCH] D87859: [flang] Unnecessary call to CHECK() for call to NULL() as an actual argument
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 14:46:18 PDT 2020
PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: klausler, tskeith.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
PeteSteinfeld requested review of this revision.
A program that passes `NULL()` to the intrinsic `ASSOCIATED()` should return an
error since section 16.9.16 requires that the pointer association status "shall
not be undefined".
In processing `NULL()` as an actual argument, the compiler ends up with an
'std::nullopt', which caused a call to 'CHECK()' to fail. But the value of
'std::nullopt' seems correct to me.
I fixed this by just removing the call to 'CHECK()' and adding a test.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87859
Files:
flang/lib/Evaluate/intrinsics.cpp
flang/test/Semantics/call07.f90
Index: flang/test/Semantics/call07.f90
===================================================================
--- flang/test/Semantics/call07.f90
+++ flang/test/Semantics/call07.f90
@@ -21,6 +21,8 @@
real, pointer :: a02(:)
real, target :: a03(10)
real :: a04(10) ! not TARGET
+ !ERROR: Actual argument 'NULL()' associated with dummy argument is not a variable or typed expression
+ print *, associated(null())
call s01(a03) ! ok
!ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous
call s01(a02)
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -1510,7 +1510,6 @@
if (const Expr<SomeType> *expr{arg->UnwrapExpr()}) {
auto dc{characteristics::DummyArgument::FromActual(
std::string{d.keyword}, *expr, context)};
- CHECK(dc);
dummyArgs.emplace_back(std::move(*dc));
if (d.typePattern.kindCode == KindCode::same && !sameDummyArg) {
sameDummyArg = j;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87859.292627.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200917/697dd8d2/attachment.bin>
More information about the llvm-commits
mailing list