diff options
Diffstat (limited to 'flang/test/Semantics')
-rw-r--r-- | flang/test/Semantics/OpenACC/acc-atomic-validity.f90 | 69 | ||||
-rw-r--r-- | flang/test/Semantics/OpenACC/acc-default-none-function.f90 | 20 | ||||
-rw-r--r-- | flang/test/Semantics/assign02.f90 | 2 | ||||
-rw-r--r-- | flang/test/Semantics/bug1214.cuf | 49 | ||||
-rw-r--r-- | flang/test/Semantics/cuf11.cuf | 2 |
5 files changed, 140 insertions, 2 deletions
diff --git a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 index 07fb864..5c8d33f 100644 --- a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 +++ b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 @@ -54,11 +54,38 @@ program openacc_atomic_validity i = c(i) !$acc end atomic + !TODO: Should error because c(i) references i which is the atomic update variable. !$acc atomic capture c(i) = i i = i + 1 !$acc end atomic + !ERROR: The variables assigned in this atomic capture construct must be distinct + !$acc atomic capture + c(1) = c(2) + c(1) = c(3) + !$acc end atomic + + !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value + !$acc atomic capture + c(1) = c(2) + c(2) = c(2) + !$acc end atomic + + !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value + !$acc atomic capture + c(1) = c(2) + c(2) = c(1) + !$acc end atomic + + !ERROR: The assignments in this atomic capture construct do not update a variable and capture either its initial or final value + !$acc atomic capture + c(1) = c(2) + c(3) = c(2) + !$acc end atomic + + + !$acc atomic capture if(l .EQV. .false.) c(i) = i i = i + 1 @@ -79,3 +106,45 @@ program openacc_atomic_validity !$acc end parallel end program openacc_atomic_validity + +subroutine capture_with_convert_f64_to_i32() + integer :: x + real(8) :: v, w + x = 1 + v = 0 + w = 2 + + !$acc atomic capture + x = x * 2.5_8 + v = x + !$acc end atomic + + !$acc atomic capture + !TODO: The rhs side of this update statement cannot reference v. + x = x * v + v = x + !$acc end atomic + + !$acc atomic capture + !TODO: The rhs side of this update statement cannot reference v. + x = v * x + v = x + !$acc end atomic + + !$acc atomic capture + !ERROR: The RHS of this atomic update statement must reference the updated variable: x + x = v * v + v = x + !$acc end atomic + + !$acc atomic capture + x = v + !ERROR: The updated variable, v, cannot appear more than once in the atomic update operation + v = v * v + !$acc end atomic + + !$acc atomic capture + v = x + x = w * w + !$acc end atomic +end subroutine capture_with_convert_f64_to_i32
\ No newline at end of file diff --git a/flang/test/Semantics/OpenACC/acc-default-none-function.f90 b/flang/test/Semantics/OpenACC/acc-default-none-function.f90 new file mode 100644 index 0000000..f0a697f --- /dev/null +++ b/flang/test/Semantics/OpenACC/acc-default-none-function.f90 @@ -0,0 +1,20 @@ +! RUN: %python %S/../test_errors.py %s %flang -fopenacc -pedantic + +module mm_acc_rout_function +contains + integer function dosomething(res) + !$acc routine seq + integer :: res + dosomething = res + 1 + end function +end module + +program main + use mm_acc_rout_function + implicit none + integer :: res = 1 + !$acc serial default(none) copy(res) + res = dosomething(res) + !$acc end serial +end program + diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90 index f998197..c447078 100644 --- a/flang/test/Semantics/assign02.f90 +++ b/flang/test/Semantics/assign02.f90 @@ -139,7 +139,7 @@ contains real, target :: x real, pointer :: p p => f1() - !ERROR: pointer 'p' is associated with the result of a reference to function 'f2' that is a not a pointer + !ERROR: pointer 'p' is associated with the result of a reference to function 'f2' that is not a pointer p => f2() contains function f1() diff --git a/flang/test/Semantics/bug1214.cuf b/flang/test/Semantics/bug1214.cuf new file mode 100644 index 0000000..114fad1 --- /dev/null +++ b/flang/test/Semantics/bug1214.cuf @@ -0,0 +1,49 @@ +! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s +module overrides + type realResult + real a + end type + interface operator(*) + procedure :: multHostDevice, multDeviceHost + end interface + interface assignment(=) + procedure :: assignHostResult, assignDeviceResult + end interface + contains + elemental function multHostDevice(x, y) result(result) + real, intent(in) :: x + real, intent(in), device :: y + type(realResult) result + result%a = x * y + end + elemental function multDeviceHost(x, y) result(result) + real, intent(in), device :: x + real, intent(in) :: y + type(realResult) result + result%a = x * y + end + elemental subroutine assignHostResult(lhs, rhs) + real, intent(out) :: lhs + type(realResult), intent(in) :: rhs + lhs = rhs%a + end + elemental subroutine assignDeviceResult(lhs, rhs) + real, intent(out), device :: lhs + type(realResult), intent(in) :: rhs + lhs = rhs%a + end +end + +program p + use overrides + real, device :: da, db + real :: ha, hb +!CHECK: CALL assigndeviceresult(db,multhostdevice(2._4,da)) + db = 2. * da +!CHECK: CALL assigndeviceresult(db,multdevicehost(da,2._4)) + db = da * 2. +!CHECK: CALL assignhostresult(ha,multhostdevice(2._4,da)) + ha = 2. * da +!CHECK: CALL assignhostresult(ha,multdevicehost(da,2._4)) + ha = da * 2. +end diff --git a/flang/test/Semantics/cuf11.cuf b/flang/test/Semantics/cuf11.cuf index 554ac25..1f5beb0 100644 --- a/flang/test/Semantics/cuf11.cuf +++ b/flang/test/Semantics/cuf11.cuf @@ -16,7 +16,7 @@ subroutine sub1() real, device :: adev(10), bdev(10) real :: ahost(10) -!ERROR: More than one reference to a CUDA object on the right hand side of the assigment +!ERROR: More than one reference to a CUDA object on the right hand side of the assignment ahost = adev + bdev ahost = adev + adev |