@@ -168,8 +168,6 @@ static constexpr TypePattern SameCharNoLen{CharType, KindCode::sameKind};
168168static constexpr TypePattern SameLogical{LogicalType, KindCode::same};
169169static constexpr TypePattern SameRelatable{RelatableType, KindCode::same};
170170static constexpr TypePattern SameIntrinsic{IntrinsicType, KindCode::same};
171- static constexpr TypePattern SameDerivedType{
172- CategorySet{TypeCategory::Derived}, KindCode::same};
173171static constexpr TypePattern SameType{AnyType, KindCode::same};
174172
175173// Match some kind of some INTEGER or REAL type(s); when argument types
@@ -438,6 +436,12 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
438436 {" shift" , AnyInt}},
439437 SameInt},
440438 {" dshiftr" , {{" i" , BOZ}, {" j" , SameInt}, {" shift" , AnyInt}}, SameInt},
439+ {" eoshift" ,
440+ {{" array" , SameType, Rank::array},
441+ {" shift" , AnyInt, Rank::dimRemovedOrScalar},
442+ // BOUNDARY= is not optional for non-intrinsic types
443+ {" boundary" , SameType, Rank::dimRemovedOrScalar}, OptionalDIM},
444+ SameType, Rank::conformable, IntrinsicClass::transformationalFunction},
441445 {" eoshift" ,
442446 {{" array" , SameIntrinsic, Rank::array},
443447 {" shift" , AnyInt, Rank::dimRemovedOrScalar},
@@ -446,14 +450,6 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
446450 OptionalDIM},
447451 SameIntrinsic, Rank::conformable,
448452 IntrinsicClass::transformationalFunction},
449- {" eoshift" ,
450- {{" array" , SameDerivedType, Rank::array},
451- {" shift" , AnyInt, Rank::dimRemovedOrScalar},
452- // BOUNDARY= is not optional for derived types
453- {" boundary" , SameDerivedType, Rank::dimRemovedOrScalar},
454- OptionalDIM},
455- SameDerivedType, Rank::conformable,
456- IntrinsicClass::transformationalFunction},
457453 {" epsilon" ,
458454 {{" x" , SameReal, Rank::anyOrAssumedRank, Optionality::required,
459455 common::Intent::In, {ArgFlag::canBeMoldNull}}},
@@ -572,6 +568,10 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
572568 DefaultingKIND},
573569 KINDInt},
574570 {" int" , {{" a" , AnyNumeric, Rank::elementalOrBOZ}, DefaultingKIND}, KINDInt},
571+ {" int2" , {{" a" , AnyNumeric, Rank::elementalOrBOZ}},
572+ TypePattern{IntType, KindCode::exactKind, 2 }},
573+ {" int8" , {{" a" , AnyNumeric, Rank::elementalOrBOZ}},
574+ TypePattern{IntType, KindCode::exactKind, 8 }},
575575 {" int_ptr_kind" , {}, DefaultInt, Rank::scalar},
576576 {" ior" , {{" i" , OperandInt}, {" j" , OperandInt, Rank::elementalOrBOZ}},
577577 OperandInt},
@@ -1176,12 +1176,6 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
11761176 // procedure pointer target.
11771177 {{" index" , {{" string" , DefaultChar}, {" substring" , DefaultChar}},
11781178 DefaultInt}},
1179- {{" int2" , {{" a" , AnyNumeric, Rank::elementalOrBOZ}},
1180- TypePattern{IntType, KindCode::exactKind, 2 }},
1181- " int" },
1182- {{" int8" , {{" a" , AnyNumeric, Rank::elementalOrBOZ}},
1183- TypePattern{IntType, KindCode::exactKind, 8 }},
1184- " int" },
11851179 {{" isign" , {{" a" , DefaultInt}, {" b" , DefaultInt}}, DefaultInt}, " sign" },
11861180 {{" jiabs" , {{" a" , TypePattern{IntType, KindCode::exactKind, 4 }}},
11871181 TypePattern{IntType, KindCode::exactKind, 4 }},
@@ -1939,12 +1933,16 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
19391933 dimArg = j;
19401934 argOk = true ;
19411935 break ;
1942- case KindCode::same:
1936+ case KindCode::same: {
19431937 if (!sameArg) {
19441938 sameArg = arg;
19451939 }
1946- argOk = type->IsTkLenCompatibleWith (sameArg->GetType ().value ());
1947- break ;
1940+ // Check both ways so that a CLASS(*) actuals to
1941+ // MOVE_ALLOC and EOSHIFT both work.
1942+ auto sameType{sameArg->GetType ().value ()};
1943+ argOk = sameType.IsTkLenCompatibleWith (*type) ||
1944+ type->IsTkLenCompatibleWith (sameType);
1945+ } break ;
19481946 case KindCode::sameKind:
19491947 if (!sameArg) {
19501948 sameArg = arg;
@@ -2849,15 +2847,16 @@ IntrinsicProcTable::Implementation::HandleC_F_Pointer(
28492847 " FPTR= argument to C_F_POINTER() may not have a deferred type parameter" _err_en_US);
28502848 } else if (type->category () == TypeCategory::Derived) {
28512849 if (context.languageFeatures ().ShouldWarn (
2852- common::UsageWarning::Interoperability)) {
2853- if (type->IsUnlimitedPolymorphic ()) {
2854- context.messages ().Say (common::UsageWarning::Interoperability, at,
2855- " FPTR= argument to C_F_POINTER() should not be unlimited polymorphic" _warn_en_US);
2856- } else if (!type->GetDerivedTypeSpec ().typeSymbol ().attrs ().test (
2857- semantics::Attr::BIND_C)) {
2858- context.messages ().Say (common::UsageWarning::Interoperability, at,
2859- " FPTR= argument to C_F_POINTER() should not have a derived type that is not BIND(C)" _warn_en_US);
2860- }
2850+ common::UsageWarning::Interoperability) &&
2851+ type->IsUnlimitedPolymorphic ()) {
2852+ context.messages ().Say (common::UsageWarning::Interoperability, at,
2853+ " FPTR= argument to C_F_POINTER() should not be unlimited polymorphic" _warn_en_US);
2854+ } else if (!type->GetDerivedTypeSpec ().typeSymbol ().attrs ().test (
2855+ semantics::Attr::BIND_C) &&
2856+ context.languageFeatures ().ShouldWarn (
2857+ common::UsageWarning::Portability)) {
2858+ context.messages ().Say (common::UsageWarning::Portability, at,
2859+ " FPTR= argument to C_F_POINTER() should not have a derived type that is not BIND(C)" _port_en_US);
28612860 }
28622861 } else if (!IsInteroperableIntrinsicType (
28632862 *type, &context.languageFeatures ())
0 commit comments