@@ -3003,17 +3003,17 @@ parser::Messages CheckHelper::WhyNotInteroperableDerivedType(
30033003 } else {
30043004 msgs.Annex (std::move (bad));
30053005 }
3006- } else if (!IsInteroperableIntrinsicType (
3007- *type, context_.languageFeatures ())
3006+ } else if (auto dyType{evaluate::DynamicType::From (*type)}; dyType &&
3007+ !evaluate::IsInteroperableIntrinsicType (
3008+ *dyType, &context_.languageFeatures ())
30083009 .value_or (false )) {
3009- auto maybeDyType{evaluate::DynamicType::From (*type)};
30103010 if (type->category () == DeclTypeSpec::Logical) {
30113011 if (context_.ShouldWarn (common::UsageWarning::LogicalVsCBool)) {
30123012 msgs.Say (component.name (),
30133013 " A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL" _port_en_US);
30143014 }
3015- } else if (type->category () == DeclTypeSpec::Character &&
3016- maybeDyType && maybeDyType ->kind () == 1 ) {
3015+ } else if (type->category () == DeclTypeSpec::Character && dyType &&
3016+ dyType ->kind () == 1 ) {
30173017 if (context_.ShouldWarn (common::UsageWarning::BindCCharLength)) {
30183018 msgs.Say (component.name (),
30193019 " A CHARACTER component of an interoperable type should have length 1" _port_en_US);
@@ -3106,10 +3106,15 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(const Symbol &symbol) {
31063106 type->category () == DeclTypeSpec::Character &&
31073107 type->characterTypeSpec ().length ().isDeferred ()) {
31083108 // ok; F'2023 18.3.7 p2(6)
3109- } else if (derived ||
3110- IsInteroperableIntrinsicType (*type, context_.languageFeatures ())
3111- .value_or (false )) {
3109+ } else if (derived) { // type has been checked
3110+ } else if (auto dyType{evaluate::DynamicType::From (*type)}; dyType &&
3111+ evaluate::IsInteroperableIntrinsicType (*dyType,
3112+ InModuleFile () ? nullptr : &context_.languageFeatures ())
3113+ .value_or (false )) {
31123114 // F'2023 18.3.7 p2(4,5)
3115+ // N.B. Language features are not passed to IsInteroperableIntrinsicType
3116+ // when processing a module file, since the module file might have been
3117+ // compiled with CUDA while the client is not.
31133118 } else if (type->category () == DeclTypeSpec::Logical) {
31143119 if (context_.ShouldWarn (common::UsageWarning::LogicalVsCBool) &&
31153120 !InModuleFile ()) {
0 commit comments