@@ -545,6 +545,12 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
545545 KINDInt, Rank::vector, IntrinsicClass::transformationalFunction},
546546 {" floor" , {{" a" , AnyReal}, DefaultingKIND}, KINDInt},
547547 {" fraction" , {{" x" , SameReal}}, SameReal},
548+ {" fseek" ,
549+ {{" unit" , AnyInt, Rank::scalar}, {" offset" , AnyInt, Rank::scalar},
550+ {" whence" , AnyInt, Rank::scalar}},
551+ DefaultInt, Rank::scalar},
552+ {" ftell" , {{" unit" , AnyInt, Rank::scalar}},
553+ TypePattern{IntType, KindCode::exactKind, 8 }, Rank::scalar},
548554 {" gamma" , {{" x" , SameReal}}, SameReal},
549555 {" get_team" , {{" level" , DefaultInt, Rank::scalar, Optionality::optional}},
550556 TeamType, Rank::scalar, IntrinsicClass::transformationalFunction},
@@ -1083,11 +1089,16 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
10831089// LOC, probably others
10841090// TODO: Optionally warn on operand promotion extension
10851091
1086- // Aliases for a few generic intrinsic functions for legacy
1087- // compatibility and builtins.
1092+ // Aliases for a few generic procedures for legacy compatibility and builtins.
10881093static const std::pair<const char *, const char *> genericAlias[]{
10891094 {" and" , " iand" },
10901095 {" getenv" , " get_environment_variable" },
1096+ {" fseek64" , " fseek" },
1097+ {" fseeko64" , " fseek" }, // SUN
1098+ {" fseeki8" , " fseek" }, // Intel
1099+ {" ftell64" , " ftell" },
1100+ {" ftello64" , " ftell" }, // SUN
1101+ {" ftelli8" , " ftell" }, // Intel
10911102 {" imag" , " aimag" },
10921103 {" lshift" , " shiftl" },
10931104 {" or" , " ior" },
@@ -1524,6 +1535,17 @@ static const IntrinsicInterface intrinsicSubroutine[]{
15241535 {" exit" , {{" status" , DefaultInt, Rank::scalar, Optionality::optional}}, {},
15251536 Rank::elemental, IntrinsicClass::impureSubroutine},
15261537 {" free" , {{" ptr" , Addressable}}, {}},
1538+ {" fseek" ,
1539+ {{" unit" , AnyInt, Rank::scalar}, {" offset" , AnyInt, Rank::scalar},
1540+ {" whence" , AnyInt, Rank::scalar},
1541+ {" status" , AnyInt, Rank::scalar, Optionality::optional,
1542+ common::Intent::InOut}},
1543+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
1544+ {" ftell" ,
1545+ {{" unit" , AnyInt, Rank::scalar},
1546+ {" offset" , AnyInt, Rank::scalar, Optionality::required,
1547+ common::Intent::Out}},
1548+ {}, Rank::elemental, IntrinsicClass::impureSubroutine},
15271549 {" get_command" ,
15281550 {{" command" , DefaultChar, Rank::scalar, Optionality::optional,
15291551 common::Intent::Out},
@@ -2811,9 +2833,9 @@ bool IntrinsicProcTable::Implementation::IsDualIntrinsic(
28112833 const std::string &name) const {
28122834 // Collection for some intrinsics with function and subroutine form,
28132835 // in order to pass the semantic check.
2814- static const std::string dualIntrinsic[]{{" chdir" s }, {" etime" s }, {" getcwd " s },
2815- {" hostnm " s }, {" rename " s }, {" second " s }, {" system " s }, {" unlink " s}};
2816-
2836+ static const std::string dualIntrinsic[]{{" chdir" }, {" etime" }, {" fseek " },
2837+ {" ftell " }, {" getcwd " }, {" hostnm " }, {" rename " }, {" second " }, { " system " },
2838+ { " unlink " }};
28172839 return llvm::is_contained (dualIntrinsic, name);
28182840}
28192841
0 commit comments