Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flang/lib/Semantics/check-cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ static void CheckReduce(
case parser::ReductionOperator::Operator::Multiply:
case parser::ReductionOperator::Operator::Max:
case parser::ReductionOperator::Operator::Min:
isOk = cat == TypeCategory::Integer || cat == TypeCategory::Real;
isOk = cat == TypeCategory::Integer || cat == TypeCategory::Real ||
cat == TypeCategory::Complex;
break;
case parser::ReductionOperator::Operator::Iand:
case parser::ReductionOperator::Operator::Ior:
Expand Down
6 changes: 5 additions & 1 deletion flang/test/Semantics/reduce.cuf
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
subroutine s(n,m,a,l)
subroutine s(n,m,a,l,c)
integer, intent(in) :: n
integer, device, intent(in) :: m(n)
real, device, intent(in) :: a(n)
logical, device, intent(in) :: l(n)
integer j, mr
real ar
logical lr
complex :: cr
complex, device, intent(in) :: c(n)
!$cuf kernel do <<<*,*>>> reduce (+:mr,ar)
do j=1,n; mr = mr + m(j); ar = ar + a(j); end do
!ERROR: !$CUF KERNEL DO REDUCE operation is not acceptable for a variable with type LOGICAL(4)
Expand Down Expand Up @@ -69,4 +71,6 @@ subroutine s(n,m,a,l)
!ERROR: !$CUF KERNEL DO REDUCE operation is not acceptable for a variable with type REAL(4)
!$cuf kernel do <<<*,*>>> reduce (.or.:mr,ar)
do j=1,n; end do
!$cuf kernel do <<<*,*>>> reduce (+:cr) ! ok complex type
do j=1,n; cr = cr + c(j); end do
end
Loading