[flang] Fix crash in fuzzing test (#122189)
Fixes https://github.com/llvm/llvm-project/issues/121972.
This commit is contained in:
@@ -1320,6 +1320,9 @@ template <TypeCategory TO, TypeCategory FROM>
|
||||
static std::optional<Expr<SomeType>> DataConstantConversionHelper(
|
||||
FoldingContext &context, const DynamicType &toType,
|
||||
const Expr<SomeType> &expr) {
|
||||
if (!IsValidKindOfIntrinsicType(FROM, toType.kind())) {
|
||||
return std::nullopt;
|
||||
}
|
||||
DynamicType sizedType{FROM, toType.kind()};
|
||||
if (auto sized{
|
||||
Fold(context, ConvertToType(sizedType, Expr<SomeType>{expr}))}) {
|
||||
|
||||
5
flang/test/Semantics/bug121972.f90
Normal file
5
flang/test/Semantics/bug121972.f90
Normal file
@@ -0,0 +1,5 @@
|
||||
! RUN: %python %S/test_errors.py %s %flang_fc1
|
||||
module acc_declare_test
|
||||
! ERROR: Initialization expression cannot be converted to declared type of 'ifcondition' from LOGICAL(4)
|
||||
integer(16), parameter :: ifCondition = .FALSE.
|
||||
end module
|
||||
Reference in New Issue
Block a user