[flang-commits] [flang] [flang][nfc] Support volatility in Fir ops (PR #134858)

Asher Mancinelli via flang-commits flang-commits at lists.llvm.org
Tue Apr 22 08:21:48 PDT 2025


================
@@ -1787,6 +1843,10 @@ llvm::LogicalResult fir::EmboxOp::verify() {
     return emitOpError("slice must not be provided for a scalar");
   if (getSourceBox() && !mlir::isa<fir::ClassType>(getResult().getType()))
     return emitOpError("source_box must be used with fir.class result type");
+  if (fir::isa_volatile_type(getMemref().getType()) !=
+      fir::isa_volatile_type(getResult().getType()))
+    return emitOpError("cannot convert between volatile and non-volatile "
+                       "types, use fir.volatile_cast instead");
----------------
ashermancinelli wrote:

Yes, I just found this test in the gfortran test suite that shows this:
```
llvm-test-suite/Fortran/gfortran/regression/dec_loc_rval_2.f90
```
I'll correct it, thank you!

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


More information about the flang-commits mailing list