diff --git a/flang/lib/Evaluate/type.cpp b/flang/lib/Evaluate/type.cpp --- a/flang/lib/Evaluate/type.cpp +++ b/flang/lib/Evaluate/type.cpp @@ -179,7 +179,7 @@ } } } else { - return targetCharacteristics.GetAlignment(category_, kind_); + return targetCharacteristics.GetAlignment(category_, kind()); } return 1; // needs to be after switch to dodge a bogus gcc warning } @@ -193,14 +193,14 @@ case TypeCategory::Complex: case TypeCategory::Logical: return Expr{ - context.targetCharacteristics().GetByteSize(category_, kind_)}; + context.targetCharacteristics().GetByteSize(category_, kind())}; case TypeCategory::Character: if (auto len{charLength ? Expr{Constant{ *charLength}} : GetCharLength()}) { return Fold(context, Expr{ - context.targetCharacteristics().GetByteSize(category_, kind_)} * + context.targetCharacteristics().GetByteSize(category_, kind())} * std::move(*len)); } break; @@ -540,7 +540,11 @@ return x.kind() == y.kind() && (ignoreLengths || !xLen || !yLen || *xLen == *yLen); } else if (x.category() != TypeCategory::Derived) { - return x.kind() == y.kind(); + if (x.IsTypelessIntrinsicArgument()) { + return y.IsTypelessIntrinsicArgument(); + } else { + return !y.IsTypelessIntrinsicArgument() && x.kind() == y.kind(); + } } else { const auto *xdt{GetDerivedTypeSpec(x)}; const auto *ydt{GetDerivedTypeSpec(y)}; @@ -651,7 +655,7 @@ case TypeCategory::Integer: switch (that.category_) { case TypeCategory::Integer: - return DynamicType{TypeCategory::Integer, std::max(kind_, that.kind_)}; + return DynamicType{TypeCategory::Integer, std::max(kind(), that.kind())}; case TypeCategory::Real: case TypeCategory::Complex: return that; @@ -664,9 +668,9 @@ case TypeCategory::Integer: return *this; case TypeCategory::Real: - return DynamicType{TypeCategory::Real, std::max(kind_, that.kind_)}; + return DynamicType{TypeCategory::Real, std::max(kind(), that.kind())}; case TypeCategory::Complex: - return DynamicType{TypeCategory::Complex, std::max(kind_, that.kind_)}; + return DynamicType{TypeCategory::Complex, std::max(kind(), that.kind())}; default: CRASH_NO_CASE; } @@ -677,7 +681,7 @@ return *this; case TypeCategory::Real: case TypeCategory::Complex: - return DynamicType{TypeCategory::Complex, std::max(kind_, that.kind_)}; + return DynamicType{TypeCategory::Complex, std::max(kind(), that.kind())}; default: CRASH_NO_CASE; } @@ -685,7 +689,7 @@ case TypeCategory::Logical: switch (that.category_) { case TypeCategory::Logical: - return DynamicType{TypeCategory::Logical, std::max(kind_, that.kind_)}; + return DynamicType{TypeCategory::Logical, std::max(kind(), that.kind())}; default: CRASH_NO_CASE; }