CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
107 lines
5.1 KiB
Fortran
107 lines
5.1 KiB
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Tests for F'2023 C1132:
|
|
! A variable-name that appears in a REDUCE locality-spec shall be of intrinsic
|
|
! type suitable for the intrinsic operation or function specified by its
|
|
! reduce-operation.
|
|
|
|
subroutine s1(n)
|
|
! This is OK
|
|
integer :: i1, i2, i3, i4, i5, i6, i7, n
|
|
real(8) :: r1, r2, r3, r4
|
|
complex :: c1, c2
|
|
logical :: l1, l2, l3(n,n), l4(n)
|
|
do concurrent(i=1:5) &
|
|
& reduce(+:i1,r1,c1) reduce(*:i2,r2,c2) reduce(iand:i3) reduce(ieor:i4) &
|
|
& reduce(ior:i5) reduce(max:i6,r3) reduce(min:i7,r4) reduce(.and.:l1) &
|
|
& reduce(.or.:l2) reduce(.eqv.:l3) reduce(.neqv.:l4)
|
|
end do
|
|
end subroutine s1
|
|
|
|
subroutine s2()
|
|
! Cannot apply logical operations to integer variables
|
|
integer :: i1, i2, i3, i4
|
|
!ERROR: Reduction variable 'i1' ('INTEGER(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'i2' ('INTEGER(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'i3' ('INTEGER(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'i4' ('INTEGER(4)') does not have a suitable type ('LOGICAL').
|
|
do concurrent(i=1:5) &
|
|
& reduce(.and.:i1) reduce(.or.:i2) reduce(.eqv.:i3) reduce(.neqv.:i4)
|
|
end do
|
|
end subroutine s2
|
|
|
|
subroutine s3()
|
|
! Cannot apply integer/logical operations to real variables
|
|
real :: r1, r2, r3, r4
|
|
!ERROR: Reduction variable 'r1' ('REAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'r2' ('REAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'r3' ('REAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'r4' ('REAL(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'r5' ('REAL(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'r6' ('REAL(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'r7' ('REAL(4)') does not have a suitable type ('LOGICAL').
|
|
do concurrent(i=1:5) &
|
|
& reduce(iand:r1) reduce(ieor:r2) reduce(ior:r3) reduce(.and.:r4) &
|
|
& reduce(.or.:r5) reduce(.eqv.:r6) reduce(.neqv.:r7)
|
|
end do
|
|
end subroutine s3
|
|
|
|
subroutine s4()
|
|
! Cannot apply integer/logical operations to complex variables
|
|
complex :: c1, c2, c3, c4, c5, c6, c7, c8, c9
|
|
!ERROR: Reduction variable 'c1' ('COMPLEX(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'c2' ('COMPLEX(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'c3' ('COMPLEX(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'c4' ('COMPLEX(4)') does not have a suitable type ('INTEGER', or 'REAL').
|
|
!ERROR: Reduction variable 'c5' ('COMPLEX(4)') does not have a suitable type ('INTEGER', or 'REAL').
|
|
!ERROR: Reduction variable 'c6' ('COMPLEX(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'c7' ('COMPLEX(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'c8' ('COMPLEX(4)') does not have a suitable type ('LOGICAL').
|
|
!ERROR: Reduction variable 'c9' ('COMPLEX(4)') does not have a suitable type ('LOGICAL').
|
|
do concurrent(i=1:5) &
|
|
& reduce(iand:c1) reduce(ieor:c2) reduce(ior:c3) reduce(max:c4) &
|
|
& reduce(min:c5) reduce(.and.:c6) reduce(.or.:c7) reduce(.eqv.:c8) &
|
|
& reduce(.neqv.:c9)
|
|
end do
|
|
end subroutine s4
|
|
|
|
subroutine s5()
|
|
! Cannot apply integer operations to logical variables
|
|
logical :: l1, l2, l3, l4, l5, l6, l7
|
|
!ERROR: Reduction variable 'l1' ('LOGICAL(4)') does not have a suitable type ('COMPLEX', 'INTEGER', or 'REAL').
|
|
!ERROR: Reduction variable 'l2' ('LOGICAL(4)') does not have a suitable type ('COMPLEX', 'INTEGER', or 'REAL').
|
|
!ERROR: Reduction variable 'l3' ('LOGICAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'l4' ('LOGICAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'l5' ('LOGICAL(4)') does not have a suitable type ('INTEGER').
|
|
!ERROR: Reduction variable 'l6' ('LOGICAL(4)') does not have a suitable type ('INTEGER', or 'REAL').
|
|
!ERROR: Reduction variable 'l7' ('LOGICAL(4)') does not have a suitable type ('INTEGER', or 'REAL').
|
|
do concurrent(i=1:5) &
|
|
& reduce(+:l1) reduce(*:l2) reduce(iand:l3) reduce(ieor:l4) &
|
|
& reduce(ior:l5) reduce(max:l6) reduce(min:l7)
|
|
end do
|
|
end subroutine s5
|
|
|
|
subroutine s6()
|
|
! Cannot reduce a character
|
|
character ch
|
|
!ERROR: Reduction variable 'ch' ('CHARACTER(1_8,1)') does not have a suitable type ('COMPLEX', 'INTEGER', or 'REAL').
|
|
do concurrent(i=1:5) reduce(+:ch)
|
|
end do
|
|
end subroutine s6
|
|
|
|
subroutine s7()
|
|
! The '-' reduction operator is not supported for a DO CONCURRENT REDUCE
|
|
! locality-spec, regardless of the reduction variable's type.
|
|
integer :: i1
|
|
real :: r1
|
|
complex :: c1
|
|
!ERROR: '-' is not a supported reduction operator in a DO CONCURRENT REDUCE locality specifier
|
|
do concurrent(i=1:5) reduce(-:i1)
|
|
end do
|
|
!ERROR: '-' is not a supported reduction operator in a DO CONCURRENT REDUCE locality specifier
|
|
do concurrent(i=1:5) reduce(-:r1)
|
|
end do
|
|
!ERROR: '-' is not a supported reduction operator in a DO CONCURRENT REDUCE locality specifier
|
|
do concurrent(i=1:5) reduce(-:c1)
|
|
end do
|
|
end subroutine s7
|