[PATCH] D79282: [flang] Fixed a crash
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 2 12:42:53 PDT 2020
PeteSteinfeld updated this revision to Diff 261659.
PeteSteinfeld added a comment.
1. Updating D79282 <https://reviews.llvm.org/D79282>: [flang] Fixed a crash #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create
Added a declaration to make the test case crash the compiler
The declaration of the type wasn't enough to cause the crash. I needed to
declare an object of that type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79282/new/
https://reviews.llvm.org/D79282
Files:
flang/lib/Semantics/type.cpp
flang/test/Semantics/resolve33.f90
Index: flang/test/Semantics/resolve33.f90
===================================================================
--- flang/test/Semantics/resolve33.f90
+++ flang/test/Semantics/resolve33.f90
@@ -30,4 +30,11 @@
!ERROR: Type parameter, component, or procedure binding 'a' already defined in this type
integer, len :: a
end type
+ !ERROR: No definition found for type parameter 'k'
+ !ERROR: No definition found for type parameter 'l'
+ type :: t6(k, l)
+ !ERROR: Must be a constant value
+ character(kind=k, len=l) :: d3
+ end type
+ type(t6(2, 10)) :: x3
end module
Index: flang/lib/Semantics/type.cpp
===================================================================
--- flang/lib/Semantics/type.cpp
+++ flang/lib/Semantics/type.cpp
@@ -77,7 +77,9 @@
name = *nextNameIter++;
auto it{std::find_if(parameterDecls.begin(), parameterDecls.end(),
[&](const Symbol &symbol) { return symbol.name() == name; })};
- CHECK(it != parameterDecls.end());
+ if (it == parameterDecls.end()) {
+ break;
+ }
attr = it->get().get<TypeParamDetails>().attr();
} else {
messages.Say(name_,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79282.261659.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200502/c096ce5e/attachment.bin>
More information about the llvm-commits
mailing list