[PATCH] D80593: [flang] Fixed crash on forward referenced `len` parameter
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 26 15:17:47 PDT 2020
PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: tskeith, klausler.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Using a forward reference to define a `len` parameter causes a crash. To fix
it, I removed the call to `CHECK()`, which didn't seem to have any bad effects.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80593
Files:
flang/lib/Evaluate/variable.cpp
flang/test/Semantics/resolve91.f90
Index: flang/test/Semantics/resolve91.f90
===================================================================
--- flang/test/Semantics/resolve91.f90
+++ flang/test/Semantics/resolve91.f90
@@ -44,3 +44,10 @@
real, dimension(:), pointer :: realArray => localArray
end type
end module m4
+
+module m5
+ !ERROR: Actual argument for 'string=' has bad type 'REAL(4)'
+ character(len=len(a)) :: b
+ !ERROR: The type of 'a' has already been implicitly declared
+ character(len=len(b)) :: a
+end module m5
Index: flang/lib/Evaluate/variable.cpp
===================================================================
--- flang/lib/Evaluate/variable.cpp
+++ flang/lib/Evaluate/variable.cpp
@@ -240,7 +240,6 @@
const NamedEntity &base, Field field, int dim)
: base_{base}, field_{field}, dimension_{dim} {
const Symbol &last{base_.GetLastSymbol()};
- CHECK(IsDescriptor(last));
CHECK((field == Field::Len && dim == 0) ||
(field != Field::Len && dim >= 0 && dim < last.Rank()));
}
@@ -248,7 +247,6 @@
DescriptorInquiry::DescriptorInquiry(NamedEntity &&base, Field field, int dim)
: base_{std::move(base)}, field_{field}, dimension_{dim} {
const Symbol &last{base_.GetLastSymbol()};
- CHECK(IsDescriptor(last));
CHECK((field == Field::Len && dim == 0) ||
(field != Field::Len && dim >= 0 && dim < last.Rank()));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80593.266346.patch
Type: text/x-patch
Size: 1356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/ba6f50c1/attachment.bin>
More information about the llvm-commits
mailing list