@@ -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},
@@ -1073,11 +1079,16 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
10731079// LOC, probably others
10741080// TODO: Optionally warn on operand promotion extension
10751081
1076- // Aliases for a few generic intrinsic functions for legacy
1077- // compatibility and builtins.
1082+ // Aliases for a few generic procedures for legacy compatibility and builtins.
10781083static const std::pair<const char *, const char *> genericAlias[]{
10791084 {" and" , " iand" },
10801085 {" getenv" , " get_environment_variable" },
1086+ {" fseek64" , " fseek" },
1087+ {" fseeko64" , " fseek" }, // SUN
1088+ {" fseeki8" , " fseek" }, // Intel
1089+ {" ftell64" , " ftell" },
1090+ {" ftello64" , " ftell" }, // SUN
1091+ {" ftelli8" , " ftell" }, // Intel
10811092 {" imag" , " aimag" },
10821093 {" lshift" , " shiftl" },
10831094 {" or" , " ior" },
@@ -1506,6 +1517,17 @@ static const IntrinsicInterface intrinsicSubroutine[]{
15061517 {" exit" , {{" status" , DefaultInt, Rank::scalar, Optionality::optional}}, {},
15071518 Rank::elemental, IntrinsicClass::impureSubroutine},
15081519 {" free" , {{" ptr" , Addressable}}, {}},
1520+ {" fseek" ,
1521+ {{" unit" , AnyInt, Rank::scalar}, {" offset" , AnyInt, Rank::scalar},
1522+ {" whence" , AnyInt, Rank::scalar},
1523+ {" status" , AnyInt, Rank::scalar, Optionality::optional,
1524+ common::Intent::InOut}},
1525+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
1526+ {" ftell" ,
1527+ {{" unit" , AnyInt, Rank::scalar},
1528+ {" offset" , AnyInt, Rank::scalar, Optionality::required,
1529+ common::Intent::Out}},
1530+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
15091531 {" get_command" ,
15101532 {{" command" , DefaultChar, Rank::scalar, Optionality::optional,
15111533 common::Intent::Out},
@@ -2764,8 +2786,8 @@ bool IntrinsicProcTable::Implementation::IsDualIntrinsic(
27642786 const std::string &name) const {
27652787 // Collection for some intrinsics with function and subroutine form,
27662788 // in order to pass the semantic check.
2767- static const std::string dualIntrinsic[]{{" chdir" s }, {" etime" s }, {" getcwd " s },
2768- {" rename" s }, {" second" s }, {" system" s }};
2789+ static const std::string dualIntrinsic[]{{" chdir" }, {" etime" }, {" fseek " },
2790+ {" ftell " }, { " getcwd " }, { " rename" }, {" second" }, {" system" }};
27692791
27702792 return llvm::is_contained (dualIntrinsic, name);
27712793}
0 commit comments