forked from OSchip/llvm-project
[flang] Fix assert on bad character kind
When we report an error for a bad character kind, don't keep it in the `DeclTypeSpec`. Otherwise there could be further problems. In this case, `ComputeOffsets()` got an assertion error because we didn't recognize `CHARACTER(*,8)` as needing a descriptor because of the bad kind. Fixes https://bugs.llvm.org/show_bug.cgi?id=47173 Differential Revision: https://reviews.llvm.org/D86357
This commit is contained in:
parent
bb894b9782
commit
c0c3cafa2b
|
@ -3461,6 +3461,7 @@ void DeclarationVisitor::Post(const parser::CharSelector::LengthAndKind &x) {
|
|||
TypeCategory::Character, *intKind)) { // C715, C719
|
||||
Say(currStmtSource().value(),
|
||||
"KIND value (%jd) not valid for CHARACTER"_err_en_US, *intKind);
|
||||
charInfo_.kind = std::nullopt; // prevent further errors
|
||||
}
|
||||
if (x.length) {
|
||||
charInfo_.length = GetParamValue(*x.length, common::TypeParamAttr::Len);
|
||||
|
|
|
@ -83,3 +83,9 @@ character(len=*), parameter :: cvar10 = 4_"abcd"
|
|||
!ERROR: CHARACTER(KIND=8) is not a supported type
|
||||
character(len=*), parameter :: cvar11 = 8_"abcd"
|
||||
end program
|
||||
|
||||
subroutine s(a, b)
|
||||
character(*,2) :: a
|
||||
!ERROR: KIND value (8) not valid for CHARACTER
|
||||
character(*,8) :: b
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue