[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:38 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,
----------------
mlir-maiden wrote:

Thank you, Peter. And nice to e-meet you. 
I tested this with gfortran using -fdefault-real-8 to check whether SECNDS follows the default REAL kind. It turns out SECNDS requires REAL(4) explicitly. When compiled with 
-fdefault-real-8, it produces a compile-time error:
'x' argument of 'secnds' intrinsic ... must be of kind 4

So the use of KindCode::exactKind, 4 matches gfortran's behavior.

Also noted on Optionality::required and Intent::In. I will drop those for clarity.

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


More information about the flang-commits mailing list