diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp --- a/flang/lib/Lower/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP.cpp @@ -677,7 +677,8 @@ llvm::SmallVector mapTypes; auto addMapClause = [&firOpBuilder, &converter, &mapOperands, - &mapTypes](const auto &mapClause) { + &mapTypes](const auto &mapClause, + mlir::Location ¤tLocation) { auto mapType = std::get( std::get>(mapClause->v.t) ->t); @@ -723,6 +724,18 @@ converter, mapOperand); for (mlir::Value mapOp : mapOperand) { + mlir::Type checkType = mapOp.getType(); + if (auto refType = checkType.dyn_cast()) + checkType = refType.getElementType(); + if (auto boxType = checkType.dyn_cast()) + checkType = boxType.getElementType(); + + if (!(fir::isa_std_type(checkType) || + checkType.isa() || + (checkType.isa() && + !checkType.cast().hasDynamicExtents()))) + TODO(currentLocation, "OMPD_target_data MapOperand type"); + mapOperands.push_back(mapOp); mapTypes.push_back(mapTypeAttr); } @@ -758,7 +771,7 @@ nowaitAttr = firOpBuilder.getUnitAttr(); } else if (const auto &mapClause = std::get_if(&clause.u)) { - addMapClause(mapClause); + addMapClause(mapClause, currentLocation); } else { TODO(currentLocation, "OMPD_target unhandled clause"); }