[flang-commits] [flang] [flang] Fix optimization of array assignments after #146408 (PR #147371)

via flang-commits flang-commits at lists.llvm.org
Tue Jul 8 00:54:06 PDT 2025


================
@@ -805,13 +805,12 @@ llvm::LogicalResult BroadcastAssignBufferization::matchAndRewrite(
                                                shape, /*slice=*/mlir::Value{});
     } else {
       // Array references must have fixed shape, when used in assignments.
+      auto refTy = mlir::cast<fir::ReferenceType>(lhs.getType());
----------------
jeanPerier wrote:

I think it is slightly unsafe to assume this cannot be a fir.heap/fir.ptr. Nothing prevents these types from describing constant shaped compiler generated objects. Please use `fir::unwrapRefType()` instead. 

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


More information about the flang-commits mailing list