[flang-commits] [flang] [flang] Register and lower SECNDS (stubbed implementation) (PR #151878)

Šárka Holendová via flang-commits flang-commits at lists.llvm.org
Sun Aug 10 08:00:39 PDT 2025


================
@@ -921,6 +921,11 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
             {"back", AnyLogical, Rank::elemental, Optionality::optional},
             DefaultingKIND},
         KINDInt},
+    {"secnds",
+        {{"x", TypePattern{RealType, KindCode::exactKind, 4}, Rank::scalar,
+            Optionality::required, common::Intent::In}},
+        TypePattern{RealType, KindCode::exactKind, 4}, Rank::scalar,
+        IntrinsicClass::impureSubroutine},
----------------
mlir-maiden wrote:

Hi Peter, quick follow-up. I realized that leaving intrinsicClass blank defaults to elementalFunction, which would misclassify SECNDS. I also misspoke earlier when I said ETIME was left unclassified. I know it has two entries: one in genericIntrinsicFunction[] (unclassified, so it defaults to elementalFunction), and another in the intrinsicSubroutine table, where it’s correctly marked. 
It also raises a question, since ETIME is impure and reads the system clock, should ETIME’s function form really default to elementalFunction? I am not sure what the best fit is for SECNDS. Thank you

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


More information about the flang-commits mailing list