[llvm] [flang][runtime] Fix CUDA flang-rt build breakage (PR #135220)

Peter Klausler via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 10:39:21 PDT 2025


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/135220

I used "std::nullopt" instead of the correct "Fortran::common::nullopt" in a recent patch, and you can get away with that only for CPU builds.  Fix.

>From 9259d85ca01c8b68588c8fd87670f3889f27e596 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Thu, 10 Apr 2025 10:35:34 -0700
Subject: [PATCH] [flang][runtime] Fix CUDA flang-rt build breakage

I used "std::nullopt" instead of the correct "Fortran::common::nullopt"
in a recent patch, and you can get away with that only for CPU
builds.  Fix.
---
 flang-rt/include/flang-rt/runtime/io-stmt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang-rt/include/flang-rt/runtime/io-stmt.h b/flang-rt/include/flang-rt/runtime/io-stmt.h
index c9c193335c940..b6e95d155d01c 100644
--- a/flang-rt/include/flang-rt/runtime/io-stmt.h
+++ b/flang-rt/include/flang-rt/runtime/io-stmt.h
@@ -156,7 +156,7 @@ class IoStatementState {
       if (at_ && at_ < limit_) {
         return *at_;
       } else {
-        return std::nullopt;
+        return Fortran::common::nullopt;
       }
     }
     RT_API_ATTRS void NextRecord(IoStatementState &io) {
@@ -200,7 +200,7 @@ class IoStatementState {
         byteCount = ch ? 1 : 0;
         return ch;
       } else if (!field->MustUseSlowPath()) {
-        return std::nullopt;
+        return Fortran::common::nullopt;
       }
     }
     return GetCurrentCharSlow(byteCount);



More information about the llvm-commits mailing list