[flang-commits] [flang] [Flang][OpenMP] Fix crash when loop index var is pointer or allocatable (PR #129717)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Wed Mar 5 06:02:52 PST 2025


================
@@ -308,7 +308,10 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
     firOpBuilder.setInsertionPointToStart(&ifOp.getThenRegion().front());
     for (auto [v, loopIV] : llvm::zip_equal(vs, loopIVs)) {
       assert(loopIV && "loopIV was not set");
-      firOpBuilder.createStoreWithConvert(loc, v, loopIV);
+      hlfir::Entity loopIVEntity{loopIV};
+      loopIVEntity =
+          hlfir::derefPointersAndAllocatables(loc, firOpBuilder, loopIVEntity);
+      firOpBuilder.create<hlfir::AssignOp>(loc, v, loopIVEntity);
----------------
kiranchandramohan wrote:

The lowering code for hlfir:Assign to fir::store seems to insert the convert, hence skipping that here.

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


More information about the flang-commits mailing list