[flang-commits] [flang] [flang] Fixed regression with CDEFINED linkage (PR #164616)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Oct 22 08:51:33 PDT 2025


================
@@ -9194,11 +9194,12 @@ bool DeclarationVisitor::CheckNonPointerInitialization(
               "'%s' has already been initialized"_err_en_US);
         } else if (IsAllocatable(ultimate)) {
           Say(name, "Allocatable object '%s' cannot be initialized"_err_en_US);
+        } else if (details->isCDefined()) {
+          // CDEFINED variables cannot have initializer, because their storage
+          // may come outside of Fortran.
+          context().Warn(common::UsageWarning::CdefinedInit, name.source,
----------------
klausler wrote:

If they can't be initialized, this should be a hard error.

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


More information about the flang-commits mailing list