@@ -543,6 +543,12 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
543543 KINDInt, Rank::vector, IntrinsicClass::transformationalFunction},
544544 {" floor" , {{" a" , AnyReal}, DefaultingKIND}, KINDInt},
545545 {" fraction" , {{" x" , SameReal}}, SameReal},
546+ {" fseek" ,
547+ {{" unit" , AnyInt, Rank::scalar}, {" offset" , AnyInt, Rank::scalar},
548+ {" whence" , AnyInt, Rank::scalar}},
549+ DefaultInt, Rank::scalar},
550+ {" ftell" , {{" unit" , AnyInt, Rank::scalar}},
551+ TypePattern{IntType, KindCode::exactKind, 8 }, Rank::scalar},
546552 {" gamma" , {{" x" , SameReal}}, SameReal},
547553 {" get_team" , {{" level" , DefaultInt, Rank::scalar, Optionality::optional}},
548554 TeamType, Rank::scalar, IntrinsicClass::transformationalFunction},
@@ -1077,11 +1083,16 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
10771083// LOC, probably others
10781084// TODO: Optionally warn on operand promotion extension
10791085
1080- // Aliases for a few generic intrinsic functions for legacy
1081- // compatibility and builtins.
1086+ // Aliases for a few generic procedures for legacy compatibility and builtins.
10821087static const std::pair<const char *, const char *> genericAlias[]{
10831088 {" and" , " iand" },
10841089 {" getenv" , " get_environment_variable" },
1090+ {" fseek64" , " fseek" },
1091+ {" fseeko64" , " fseek" }, // SUN
1092+ {" fseeki8" , " fseek" }, // Intel
1093+ {" ftell64" , " ftell" },
1094+ {" ftello64" , " ftell" }, // SUN
1095+ {" ftelli8" , " ftell" }, // Intel
10851096 {" imag" , " aimag" },
10861097 {" lshift" , " shiftl" },
10871098 {" or" , " ior" },
@@ -1510,6 +1521,17 @@ static const IntrinsicInterface intrinsicSubroutine[]{
15101521 {" exit" , {{" status" , DefaultInt, Rank::scalar, Optionality::optional}}, {},
15111522 Rank::elemental, IntrinsicClass::impureSubroutine},
15121523 {" free" , {{" ptr" , Addressable}}, {}},
1524+ {" fseek" ,
1525+ {{" unit" , AnyInt, Rank::scalar}, {" offset" , AnyInt, Rank::scalar},
1526+ {" whence" , AnyInt, Rank::scalar},
1527+ {" status" , AnyInt, Rank::scalar, Optionality::optional,
1528+ common::Intent::InOut}},
1529+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
1530+ {" ftell" ,
1531+ {{" unit" , AnyInt, Rank::scalar},
1532+ {" offset" , AnyInt, Rank::scalar, Optionality::required,
1533+ common::Intent::Out}},
1534+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
15131535 {" get_command" ,
15141536 {{" command" , DefaultChar, Rank::scalar, Optionality::optional,
15151537 common::Intent::Out},
@@ -2774,8 +2796,8 @@ bool IntrinsicProcTable::Implementation::IsDualIntrinsic(
27742796 const std::string &name) const {
27752797 // Collection for some intrinsics with function and subroutine form,
27762798 // in order to pass the semantic check.
2777- static const std::string dualIntrinsic[]{{" chdir" s }, {" etime" s }, {" getcwd " s },
2778- {" hostnm" s }, {" rename" s }, {" second" s }, {" system" s }};
2799+ static const std::string dualIntrinsic[]{{" chdir" }, {" etime" }, {" fseek " },
2800+ {" ftell " }, { " getcwd " }, { " hostnm" }, {" rename" }, {" second" }, {" system" }};
27792801
27802802 return llvm::is_contained (dualIntrinsic, name);
27812803}
0 commit comments