diff --git a/flang/runtime/tools.h b/flang/runtime/tools.h index 3fe3283415ba9..facbd23161057 100644 --- a/flang/runtime/tools.h +++ b/flang/runtime/tools.h @@ -206,6 +206,23 @@ inline RT_API_ATTRS RESULT ApplyType( default: terminator.Crash("not yet implemented: INTEGER(KIND=%d)", kind); } + case TypeCategory::Unsigned: + switch (kind) { + case 1: + return FUNC{}(std::forward(x)...); + case 2: + return FUNC{}(std::forward(x)...); + case 4: + return FUNC{}(std::forward(x)...); + case 8: + return FUNC{}(std::forward(x)...); +#if defined __SIZEOF_INT128__ && !AVOID_NATIVE_UINT128_T + case 16: + return FUNC{}(std::forward(x)...); +#endif + default: + terminator.Crash("not yet implemented: UNSIGNED(KIND=%d)", kind); + } case TypeCategory::Real: switch (kind) { #if 0 // TODO: REAL(2 & 3) diff --git a/flang/unittests/Runtime/Support.cpp b/flang/unittests/Runtime/Support.cpp index 9d1a417fdbf42..8c8de73b5b979 100644 --- a/flang/unittests/Runtime/Support.cpp +++ b/flang/unittests/Runtime/Support.cpp @@ -67,3 +67,14 @@ TEST(IsAssumedSize, Basic) { std::vector{}, std::vector{0})}; EXPECT_FALSE(RTNAME(IsAssumedSize)(*scalar)); } + +TEST(DescriptorBytesFor, Basic) { + for (size_t i = 0; i < Fortran::common::TypeCategory_enumSize; ++i) { + auto tc{static_cast(i)}; + if (tc == TypeCategory::Derived) + continue; + + auto b{Descriptor::BytesFor(tc, 4)}; + EXPECT_GT(b, 0U); + } +}