diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp index 38edd1b468215..b3f08eb81c799 100644 --- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp +++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp @@ -811,14 +811,11 @@ void ReductionProcessor::addDeclareReduction( *reductionIntrinsic)) { ReductionProcessor::ReductionIdentifier redId = ReductionProcessor::getReductionType(*reductionIntrinsic); - for (const Object &object : objectList) { - const Fortran::semantics::Symbol *symbol = object.id(); - mlir::Value symVal = converter.getSymbolAddress(*symbol); - if (auto declOp = symVal.getDefiningOp()) - symVal = declOp.getBase(); + for (mlir::Value symVal : reductionVars) { auto redType = mlir::cast(symVal.getType()); if (!redType.getEleTy().isIntOrIndexOrFloat()) - TODO(currentLocation, "User Defined Reduction on non-trivial type"); + TODO(currentLocation, + "Reduction of some types is not supported for intrinsics"); decl = createDeclareReduction( firOpBuilder, getReductionName(getRealName(*reductionIntrinsic).ToString(), diff --git a/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90 b/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90 new file mode 100644 index 0000000000000..49c899238d2a3 --- /dev/null +++ b/flang/test/Lower/OpenMP/Todo/reduction-array-intrinsic.f90 @@ -0,0 +1,11 @@ +! RUN: %not_todo_cmd bbc -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s +! RUN: %not_todo_cmd %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s + +! CHECK: not yet implemented: Reduction of some types is not supported for intrinsics +subroutine max_array_reduction(l, r) + integer :: l(:), r(:) + + !$omp parallel reduction(max:l) + l = max(l, r) + !$omp end parallel +end subroutine