[flang] [llvm] [flang] Implement FSEEK and FTELL (PR #133003)

Eugene Epshteyn via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 26 20:54:51 PDT 2025


================
@@ -1510,6 +1521,17 @@ static const IntrinsicInterface intrinsicSubroutine[]{
     {"exit", {{"status", DefaultInt, Rank::scalar, Optionality::optional}}, {},
         Rank::elemental, IntrinsicClass::impureSubroutine},
     {"free", {{"ptr", Addressable}}, {}},
+    {"fseek",
+        {{"unit", AnyInt, Rank::scalar}, {"offset", AnyInt, Rank::scalar},
+            {"whence", AnyInt, Rank::scalar},
+            {"status", AnyInt, Rank::scalar, Optionality::optional,
+                common::Intent::InOut}},
+        {}, Rank::elemental, IntrinsicClass::impureSubroutine},
+    {"ftell",
+        {{"unit", AnyInt, Rank::scalar},
+            {"offset", AnyInt, Rank::scalar, Optionality::required,
----------------
eugeneepshteyn wrote:

Well, if the function form of `ftell()` returns `INTEGER(8)`, shouldn't the subroutine form force the offset to be `INTEGER(8)` as well?  (With the caveat that GNU documentation has it as default `INTEGER`.)

https://github.com/llvm/llvm-project/pull/133003


More information about the llvm-commits mailing list