[flang-commits] [flang] [flang] Added storage specification for [hl]fir.declare. (PR #155325)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Aug 26 08:08:01 PDT 2025


================
@@ -68,3 +68,30 @@ fir::FortranVariableOpInterface::verifyDeclareLikeOpImpl(mlir::Value memref) {
   }
   return mlir::success();
 }
+
+mlir::LogicalResult
+fir::detail::verifyFortranVariableStorageOpInterface(mlir::Operation *op) {
+  auto storageIface = mlir::cast<fir::FortranVariableStorageOpInterface>(op);
+  mlir::Value storage = storageIface.getStorage();
+  std::uint64_t storageOffset = storageIface.getStorageOffset();
+  if (!storage) {
+    if (storageOffset != 0)
+      op->emitOpError("storage offset specified without the storage reference");
----------------
tblah wrote:

```suggestion
      return op->emitOpError("storage offset specified without the storage reference");
```

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


More information about the flang-commits mailing list