Skip to content

Commit

Permalink
[flang][openacc] Add error for unsupported min/max reduction on compl…
Browse files Browse the repository at this point in the history
…ex type

reduction operator min and max are not supported with complex type.
Add a proper error so it fails correctly.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D155016
  • Loading branch information
clementval committed Jul 12, 2023
1 parent e8e499f commit aaf7a0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flang/lib/Lower/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ static mlir::Value genReductionInitValue(fir::FirOpBuilder &builder,
builder.getIntegerAttr(ty, getReductionInitValue<llvm::APInt>(op, ty)));
if (op == mlir::acc::ReductionOperator::AccMin ||
op == mlir::acc::ReductionOperator::AccMax) {
if (mlir::isa<fir::ComplexType>(ty))
llvm::report_fatal_error(
"min/max reduction not supported for complex type");
if (auto floatTy = mlir::dyn_cast_or_null<mlir::FloatType>(ty))
return builder.create<mlir::arith::ConstantOp>(
loc, ty,
Expand Down

0 comments on commit aaf7a0f

Please sign in to comment.