diff --git a/Fortran/cray/f2023/10/01/CMakeLists.txt b/Fortran/cray/f2023/10/01/CMakeLists.txt new file mode 100644 index 000000000000..91548766bd46 --- /dev/null +++ b/Fortran/cray/f2023/10/01/CMakeLists.txt @@ -0,0 +1,18 @@ +# Exclude tests that require unimplemented feature (conditional expression as +# actual argument) +file(GLOB _sources *.f90) +list(REMOVE_ITEM _sources + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_array_lval_01.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_array_lval_02.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_nil_01.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_nil_02.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_nil_03.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_nil_04.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_nil_05.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/condexpr_scalar_lval_01.f90 +) +set(Source ${_sources}) + +llvm_singlesource() + +file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Fortran/cray/f2023/10/01/condexpr_array_lval_01.f90 b/Fortran/cray/f2023/10/01/condexpr_array_lval_01.f90 new file mode 100644 index 000000000000..65afa4c86704 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_lval_01.f90 @@ -0,0 +1,23 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_array_lval_01 +contains + subroutine S(X) + real :: X(3) + X = 10. * X + end subroutine S +end module M_condexpr_array_lval_01 + +program main + use M_condexpr_array_lval_01 + real :: A(5), B(5), X(3), Y(3) + do i = 1, 5 + X = [ 17.0, 19.0, 21.0 ] + Y = [ 37.0, 39.0, 41.0 ] + call S( (mod(i,2) .eq. 0 ? X : Y) ) + A(i) = X(1) + X(3) + B(i) = Y(2) - Y(1) + enddo + print *, 'A: ', A + print *, 'B: ', B +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_array_lval_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_array_lval_01.reference_output new file mode 100644 index 000000000000..833ecfd108c3 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_lval_01.reference_output @@ -0,0 +1,3 @@ + A: 38., 380., 38., 380., 38. + B: 20., 2., 20., 2., 20. +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_array_lval_02.f90 b/Fortran/cray/f2023/10/01/condexpr_array_lval_02.f90 new file mode 100644 index 000000000000..7a1bf1237443 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_lval_02.f90 @@ -0,0 +1,34 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_array_lval_02 +contains + subroutine final_sub( S_OUTPUT, S_INPUT ) + real, intent(out) :: S_OUTPUT(5) + real, intent(in) :: S_INPUT(5) + + S_OUTPUT = S_INPUT + end subroutine final_sub + + subroutine intermediate_sub(cond, ANSWER, TRUE_INPUT, FALSE_INPUT) + logical, intent(in) :: cond + real, contiguous, intent(out) :: ANSWER(:) + real, contiguous, intent(in) :: TRUE_INPUT(:) + real, contiguous, intent(in) :: FALSE_INPUT(:) + call final_sub( ANSWER, (cond ? TRUE_INPUT : FALSE_INPUT)) + end subroutine intermediate_sub +end module M_condexpr_array_lval_02 + +program main + use M_condexpr_array_lval_02 + REAL :: MAIN_A(5) + REAL :: MAIN_T(5) + REAL :: MAIN_F(5) + logical, parameter :: c(5) = [ .false., .true., .true., .false., .true. ] + + do i = 1, 5 + MAIN_T = [ 1.0, 2.0, 3.0, 4.0, 5.0 ] + MAIN_F = MAIN_T + 10.0 !-- [ 11.0, 12.0, 13.0, 14.0, 15.0 ] + call intermediate_sub(c(i), MAIN_A, MAIN_T, MAIN_F) + print '(I2,": ",5F8.2)', i, MAIN_A + enddo +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_array_lval_02.reference_output b/Fortran/cray/f2023/10/01/condexpr_array_lval_02.reference_output new file mode 100644 index 000000000000..c098ed6f92ae --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_lval_02.reference_output @@ -0,0 +1,6 @@ + 1: 11.00 12.00 13.00 14.00 15.00 + 2: 1.00 2.00 3.00 4.00 5.00 + 3: 1.00 2.00 3.00 4.00 5.00 + 4: 11.00 12.00 13.00 14.00 15.00 + 5: 1.00 2.00 3.00 4.00 5.00 +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_array_rval_01.f90 b/Fortran/cray/f2023/10/01/condexpr_array_rval_01.f90 new file mode 100644 index 000000000000..10aa5d79056a --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_rval_01.f90 @@ -0,0 +1,25 @@ +! Test for conditional expressions (Fortran 2023) + +module M_condexpr_array_rval_01 +contains + function fs(idx, sz) result(ans) + integer :: idx, sz + real :: ans(sz) + ans = [ (2.0 * idx * i, i = 1, sz) ] + end function fs +end module M_condexpr_array_rval_01 + +subroutine S(result, c1, k, sz) + use M_condexpr_array_rval_01 + logical :: c1 + integer :: k, sz + real :: result(sz) + result = ( c1 ? fs(k, sz) : [ 1.0, 2.0, 3.0 ] ) +end subroutine S + +program main + use M_condexpr_array_rval_01 + real :: r(3) + call S(r, .false., 1, 3); print *, 'False: ', r + call S(r, .true., 2, 3); print *, 'True: ', r +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_array_rval_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_array_rval_01.reference_output new file mode 100644 index 000000000000..9a1a152a33ef --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_array_rval_01.reference_output @@ -0,0 +1,3 @@ + False: 1. 2. 3. + True: 4. 8. 12. +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_01.f90 b/Fortran/cray/f2023/10/01/condexpr_nil_01.f90 new file mode 100644 index 000000000000..e01d2dc70e8f --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_01.f90 @@ -0,0 +1,60 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_nil_01 +contains + subroutine SO(X, Y, Z) + real :: X + real, optional :: Y, Z + if ( present(Y) ) then + X = X + Y + Y = 13.0 + endif + X = X + ( present(Z) ? Z/2.0 : 1000.0 ) + if ( present(Z) ) Z = 666.0 + end subroutine SO +end module M_condexpr_nil_01 + +module TM_condexpr_nil_01 +contains + subroutine test(cc) + use M_condexpr_nil_01 + logical :: cc(:) + real :: A, B, C + A = 1.0 + B = 10.0 + C = 100.0 + call SO( A, B, C ) + print '("1: ", 3F10.4)', A, B, C + + A = 2.0 + B = 20.0 + C = 200.0 + call SO( A, (cc(1) ? B : .nil.), (cc(2) ? .nil. : C) ) + print '("2: ", 3F10.4)', A, B, C + + A = 3.0 + B = 30.0 + C = 300.0 + call SO( A, (cc(3) ? B : .nil.), (cc(4) ? .nil. : C) ) + print '("3: ", 3F10.4)', A, B, C + + A = 4.0 + B = 40.0 + C = 400.0 + call SO( A, (cc(5) ? B : .nil.), (cc(6) ? .nil. : C) ) + print '("4: ", 3F10.4)', A, B, C + + A = 5.0 + B = 50.0 + C = 500.0 + call SO( A, (cc(7) ? B : .nil.), (cc(8) ? .nil. : C) ) + print '("5: ", 3F10.4)', A, B, C + end subroutine test +end module TM_condexpr_nil_01 + +program main + use TM_condexpr_nil_01 + logical, parameter :: F = .false. + logical, parameter :: T = .true. + call test( [ F, F, F, T, T, F, T, T ] ) +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_nil_01.reference_output new file mode 100644 index 000000000000..7020e6ad6584 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_01.reference_output @@ -0,0 +1,6 @@ + 1: 61.0000 13.0000 666.0000 + 2: 102.0000 20.0000 666.0000 + 3: 1003.0000 30.0000 300.0000 + 4: 244.0000 13.0000 666.0000 + 5: 1055.0000 13.0000 500.0000 +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_02.f90 b/Fortran/cray/f2023/10/01/condexpr_nil_02.f90 new file mode 100644 index 000000000000..9e448b420745 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_02.f90 @@ -0,0 +1,30 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_nil_02 +contains + subroutine test1(idx, A, B, C) + implicit none + integer :: idx + real :: A(:), B(:), C(:) + + call test2( (idx == 1 ? A : idx == 2 ? B : idx == 3 ? C : .nil.) ) + + contains + subroutine test2(W) + implicit none + real, optional :: W(:) + if ( present(W) ) W = 1.0 + end subroutine test2 + end subroutine test1 +end module M_condexpr_nil_02 + +program main + use M_condexpr_nil_02 + real :: X(5), Y(5), Z(5) + + do i = 1, 4 + X = 0.0; Y = 0.0; Z = 0.0 + call test1( i, X, Y, Z ) + print '(I2,": ",3F6.2)', i, X(1), Y(3), Z(5) + enddo +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_02.reference_output b/Fortran/cray/f2023/10/01/condexpr_nil_02.reference_output new file mode 100644 index 000000000000..4a4c8fb9dae4 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_02.reference_output @@ -0,0 +1,5 @@ + 1: 1.00 0.00 0.00 + 2: 0.00 1.00 0.00 + 3: 0.00 0.00 1.00 + 4: 0.00 0.00 0.00 +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_03.f90 b/Fortran/cray/f2023/10/01/condexpr_nil_03.f90 new file mode 100644 index 000000000000..9646f32bdb47 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_03.f90 @@ -0,0 +1,56 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_nil_03 +contains + subroutine test1(idx, A) + implicit none + integer :: idx, i + integer, optional :: A(:) + integer :: B(10) + + B = [(10*i, i=1,10)] + + call test2( A, B, (idx == 1 ? [(i, i=1,5)] : & + idx == 2 ? B(1:10:2) : & + idx == 3 ? .nil. : & + f(B(2))) ) + if ( present(A) ) then + B = -B + endif + print '(I2," B: ",(I6))', B + + contains + subroutine test2( X, Y, Z ) + implicit none + integer, optional :: X(:), Z(5) + integer :: Y(5) + if ( present(X) ) then + X = 3 * Y + endif + if ( present(Z) ) then + Y = Y + Z + endif + end subroutine test2 + end subroutine test1 + + function f(ival) result(ans) + integer :: ival, ans(5) + do i = 1, 5 + ans(i) = ival * i**2 + enddo + end function f + +end module M_condexpr_nil_03 + +program main + use M_condexpr_nil_03 + implicit none + integer :: AA(5), i + do i = 1, 4 + call test1(i) + enddo + do i = 1, 4 + call test1(i, AA) + print '(I2," AA: ",5I6)', i, AA + enddo +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_04.f90 b/Fortran/cray/f2023/10/01/condexpr_nil_04.f90 new file mode 100644 index 000000000000..9fe05142e2ee --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_04.f90 @@ -0,0 +1,43 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_nil_04 +contains + subroutine test1(idx, A) + implicit none + integer :: idx, i, A(10), B(10) + + B = [(10*i, i=1,10)] + + ! bad non-contiguous sections to contiguous actual. + ! requires copy/restore in conjuction with cond-argument. + + call test2( (idx == 1 ? B(1:10:2) : B(2:10:2)) ) + + A = B + + contains + subroutine test2( X ) + implicit none + integer, optional :: X(5) + X = [(13*i, i = 1,5)] + end subroutine test2 + end subroutine test1 + + function f(ival) result(ans) + integer :: ival, ans(5) + do i = 1, 5 + ans(i) = ival * i**2 + enddo + end function f + +end module M_condexpr_nil_04 + +program main + use M_condexpr_nil_04 + implicit none + integer :: AA(10), i + do i = 1, 2 + call test1(i, AA) + print '(I2," AA: ",5I6)', i, AA + enddo +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_nil_05.f90 b/Fortran/cray/f2023/10/01/condexpr_nil_05.f90 new file mode 100644 index 000000000000..b32af6abe5fa --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_nil_05.f90 @@ -0,0 +1,47 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_nil_05 +contains + subroutine test1(idx, A) + implicit none + integer :: idx, i, A(10), B(10) + + B = [(10*i, i=1,10)] + + call test2( A, (idx == 1 ? (idx == 2 ? err() : 23) + f(B) : .nil. ) ) + + contains + subroutine test2(A, X) + integer :: A(:) + integer, optional :: X(:) + if ( present(X) ) then + A = X + else + A = 99 + endif + end subroutine test2 + + elemental function f(ival) result(ans) + integer, intent(IN) :: ival + integer :: ans + ans = ival**2 + end function f + end subroutine test1 + + function err() result(ans) + integer ans + ans = 0 + print *, 'ERROR: err should not have been called.' + end function err + +end module M_condexpr_nil_05 + +program main + use M_condexpr_nil_05 + implicit none + integer :: AA(10), i + do i = 1, 2 + call test1(i, AA) + print '(I2," AA: ",(I6))', i, AA + enddo +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.f90 new file mode 100644 index 000000000000..174dcedb14bd --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.f90 @@ -0,0 +1,34 @@ +! Test for conditional expressions (Fortran 2023) +! +! To ensure calls under cond-expr control +! are called only when expected + +module M_condexpr_scalar_call_01 +contains + integer function f1() + f1 = 27 + end function f1 + + integer function f2(cond, side) + logical :: cond, side + if ( cond .eqv. side ) then + f2 = 100 + else + print *, 'f2: FAIL' ! should not get here. + f2 = -100 + endif + end function f2 +end module M_condexpr_scalar_call_01 + +subroutine S(A, c1 ) + use M_CONDEXPR_SCALAR_CALL_01 + integer :: A + logical :: c1 + A = f1() + ( c1 ? f2(c1, .true.) : f2(c1, .false.) ) +end subroutine S + +program main + integer :: AA + call S( AA, .false. ); print *, 'first: ', AA + call S( AA, .true. ); print *, 'second: ', AA +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.reference_output new file mode 100644 index 000000000000..223609238d92 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_01.reference_output @@ -0,0 +1,3 @@ + first: 127 + second: 127 +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.f90 new file mode 100644 index 000000000000..69e55af0a40e --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.f90 @@ -0,0 +1,31 @@ +! Test for conditional expressions (Fortran 2023) +! +! Constructors subject to a conditional expression should not be +! evaluated when the controlling condition is not satisfied. + +module M_condexpr_scalar_call_02 +contains + integer function fr(arr) + real :: arr(:) + fr = sum(arr) + end function fr + + integer function fv(x) + integer, value :: x + fv = x*x + end function fv +end module M_condexpr_scalar_call_02 + +subroutine S(result, c1, kr) + use M_condexpr_scalar_call_02 + integer :: result + logical :: c1 + real :: kr + result = 42 + ( c1 ? fr([1.0, 2.0, 3.0, 1.0/kr]) : fv(13) ) +end subroutine S + +program main + integer :: r + call S(r, .false., 0.0); print *, 'False: ', r + call S(r, .true., 1.0); print *, 'True: ', r +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.reference_output new file mode 100644 index 000000000000..e2261d5e8457 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_02.reference_output @@ -0,0 +1,3 @@ + False: 211 + True: 49 +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.f90 new file mode 100644 index 000000000000..33b95ad0db7f --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.f90 @@ -0,0 +1,30 @@ +! Test for conditional expressions (Fortran 2023) + +module M_condexpr_scalar_call_03 +contains + function fs(idx) result(ans) + integer idx + character(len=:), allocatable :: ans + if ( idx .eq. 1 ) then + ans = 'one' + else if ( idx .eq. 2 ) then + ans = 'two' + else + ans = 'other' + endif + end function fs +end module M_condexpr_scalar_call_03 + +subroutine S(result, c1, k) + use M_condexpr_scalar_call_03 + character*(*) :: result + logical :: c1 + integer :: k + result = 'ABC:' // ( c1 ? fs(k) : 'XYZ' ) +end subroutine S + +program main + character(len=7) :: r + call S(r, .false., 1); print *, 'False: ', r + call S(r, .true., 2); print *, 'True: ', r +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.reference_output new file mode 100644 index 000000000000..b023db26db15 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_03.reference_output @@ -0,0 +1,3 @@ + False: ABC:XYZ + True: ABC:two +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.f90 new file mode 100644 index 000000000000..6fd3edb0b71e --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.f90 @@ -0,0 +1,40 @@ +! Test for conditional expressions (Fortran 2023) + +module M_condexpr_scalar_call_04 + type T + real :: x, y, z + end type T +contains + function fs(idx) result(ans) + integer :: idx + type(T) :: ans + ans%x = 10.0 * idx + ans%y = 20.0 * idx + ans%z = 30.0 * idx + end function fs +end module M_condexpr_scalar_call_04 + +subroutine S(result, c1, k) + use M_condexpr_scalar_call_04 + type(T) :: result + logical :: c1 + integer :: k + result = ( c1 ? fs(k) : T(1.0, 2.0, 3.0) ) +end subroutine S + +program main + use M_condexpr_scalar_call_04 + type(T) :: r + call S(r, .false., 1) + if (r%x .eq. 1. .and. r%y .eq. 2. .and. r%z .eq. 3.) then + print *, "PASS" + else + print *, "FAIL:", r + endif + call S(r, .true., 2) + if (r%x .eq. 20. .and. r%y .eq. 40. .and. r%z .eq. 60.) then + print *, "PASS" + else + print *, "FAIL:", r + endif +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.reference_output new file mode 100644 index 000000000000..6758cf8ecb30 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_call_04.reference_output @@ -0,0 +1,3 @@ + PASS + PASS +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.f90 new file mode 100644 index 000000000000..8a1ca6722b40 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.f90 @@ -0,0 +1,23 @@ +! Test for conditional arguments (Fortran 2023) + +module M_condexpr_scalar_lval_01 +contains + subroutine S(X) + real :: X + X = 10. * X + end subroutine S +end module M_condexpr_scalar_lval_01 + +program main + use M_condexpr_scalar_lval_01 + real :: A(5), B(5) + do i = 1, 5 + X = 17.0 + Y = 37.0 + call S( (mod(i,2) .eq. 0 ? X : Y) ) + A(i) = X + B(i) = Y + enddo + print *, 'A: ', A + print *, 'B: ', B +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.reference_output new file mode 100644 index 000000000000..31a7ef3d5323 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_lval_01.reference_output @@ -0,0 +1,3 @@ + A: 17. 170. 17. 170. 17. + B: 370. 37. 370. 37. 370. +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.f90 new file mode 100644 index 000000000000..be2c9e6f0312 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.f90 @@ -0,0 +1,56 @@ +! Test for conditional expressions (Fortran 2023) + +subroutine S(c1, A, B1, B2, B3, B4, B5, C, D) + logical :: c1 + real :: A, B1, B2, B3, B4, B5, C(*), D(*) + + A = B1 + (c1 ? B2/B3 & + : (1.0/B4 < 1.0 ? 2.0 / B5 : -2.0)) + + C(1) = (D(1) > D(2) .and. D(3) < 0.0 & + ? (D(4) > 0.0 .or. D(5) > 0.0 & + ? 3.0/D(6) + D(7) : 19.0) & + : (4.0/D(8) > 0.5 ? D(9) : D(10))) + +end subroutine S + +program main + logical :: c1 + real :: A, B1, B2, B3, B4, B5, C(1), D(10) + + B1 = 100.0 + B2 = 10.0 + + c1 = .true. + B3 = 1.0 + B4 = 0.0 + B5 = 0.0 + D = [ 2.0, 1.0, -3.0, 4.0, 5.0, 6.0, 7.0, 0.0, 123.0, 456.0 ] + call S(c1, A, B1, B2, B3, B4, B5, C, D) + print *, 'A-T*;TT 110. 7.5 : ', A, C(1) + + c1 = .false. + B3 = 0.0 + B4 = 2.0 + B5 = 1.0 + D = [ 2.0, 1.0, 3.0, 4.0, -5.0, 0.0, 7.0, 4.0, 123.0, 456.0 ] + call S(c1, A, B1, B2, B3, B4, B5, C, D) + print *, 'B-FT;FT 102. 123. : ', A, C(1) + + c1 = .false. + B3 = 0.0 + B4 = 0.5 + B5 = 0.0 + D = [ 2.0, 1.0, -3.0, -4.0, -5.0, 0.0, 7.0, 9.0, 123.0, 456.0 ] + call S(c1, A, B1, B2, B3, B4, B5, C, D) + print *, 'C-FF;TF 98. 19. : ', A, C(1) + + c1 = .false. + B3 = 0.0 + B4 = 3.0 + B5 = 0.5 + D = [ 1.0, 2.0, -3.0, -4.0, -5.0, 0.0, 7.0, 9.0, 123.0, 456.0 ] + call S(c1, A, B1, B2, B3, B4, B5, C, D) + print *, 'D-FT;FF 104. 456. : ', A, C(1) + +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.reference_output new file mode 100644 index 000000000000..9442d825f7e7 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_01.reference_output @@ -0,0 +1,5 @@ + A-T*;TT 110. 7.5 : 110. 7.5 + B-FT;FT 102. 123. : 102. 123. + C-FF;TF 98. 19. : 98. 19. + D-FT;FF 104. 456. : 104. 456. +exit 0 diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.f90 b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.f90 new file mode 100644 index 000000000000..de8a161f74e5 --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.f90 @@ -0,0 +1,18 @@ +! Test for conditional expressions (Fortran 2023) + +subroutine S(A, X, n) + real :: A(n), X + X = sum(A) + X = X + ( sum(A) > 1.0 ? product(A) : A(1) ) !! PE-52297 +end subroutine S + +program main + parameter (n = 8) + real :: B(n), X = 0.0 + B = [ 1.0, 2.0, 3.0, 4.0, 4.0, 3.0, 2.0, 1.0 ] + call S(B, X, n) + print *, X + B = [ 1.0, 2.0, 3.0, 4.0, -4.0, -3.0, -2.0, -1.0 ] + call S(B, X, n) + print *, X +end program main diff --git a/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.reference_output b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.reference_output new file mode 100644 index 000000000000..27c5abe4358d --- /dev/null +++ b/Fortran/cray/f2023/10/01/condexpr_scalar_nocall_02.reference_output @@ -0,0 +1,3 @@ + 596. + 1. +exit 0 diff --git a/Fortran/cray/f2023/10/01/lit.local.cfg b/Fortran/cray/f2023/10/01/lit.local.cfg new file mode 100644 index 000000000000..116682026019 --- /dev/null +++ b/Fortran/cray/f2023/10/01/lit.local.cfg @@ -0,0 +1,2 @@ +config.traditional_output = True +config.single_source = True diff --git a/Fortran/cray/f2023/10/CMakeLists.txt b/Fortran/cray/f2023/10/CMakeLists.txt new file mode 100644 index 000000000000..416e0b44a1e6 --- /dev/null +++ b/Fortran/cray/f2023/10/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(01) diff --git a/Fortran/cray/f2023/CMakeLists.txt b/Fortran/cray/f2023/CMakeLists.txt index 31b1d84c492b..402a668da85a 100644 --- a/Fortran/cray/f2023/CMakeLists.txt +++ b/Fortran/cray/f2023/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(10) add_subdirectory(13) add_subdirectory(16)