[flang-commits] [flang] [flang] Implement CHDIR intrinsic (PR #124280)

via flang-commits flang-commits at lists.llvm.org
Fri Jan 24 08:49:17 PST 2025


================
@@ -3075,6 +3079,19 @@ IntrinsicLibrary::genChar(mlir::Type type,
   return fir::CharBoxValue{cast, len};
 }
 
+// CHDIR
+void IntrinsicLibrary::genChdir(llvm::ArrayRef<fir::ExtendedValue> args) {
+  assert(args.size() == 2);
+  mlir::Value status =
+      isStaticallyAbsent(args[1])
+          ? builder
+                .create<fir::AbsentOp>(
+                    loc, builder.getRefType(builder.getNoneType()))
+                .getResult()
+          : fir::getBase(args[1]);
+  fir::runtime::genChdir(builder, loc, fir::getBase(args[0]), status);
----------------
jeanPerier wrote:

`status` may not be an `int*` here since all kinds are allowed, I would suggest having the runtime always return an int and store that here with any casts needed.

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


More information about the flang-commits mailing list