diff --git a/Fortran/cray/f2023/13/08/CMakeLists.txt b/Fortran/cray/f2023/13/08/CMakeLists.txt new file mode 100644 index 000000000000..8b9f2da57c04 --- /dev/null +++ b/Fortran/cray/f2023/13/08/CMakeLists.txt @@ -0,0 +1,3 @@ +llvm_singlesource() + +file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Fortran/cray/f2023/13/08/leading_zero_format.f90 b/Fortran/cray/f2023/13/08/leading_zero_format.f90 new file mode 100644 index 000000000000..36862e4a8e4b --- /dev/null +++ b/Fortran/cray/f2023/13/08/leading_zero_format.f90 @@ -0,0 +1,102 @@ +! Execution tests for LZ, LZP, and LZS edit descriptors (Fortran 2023). +! LZ = processor-defined leading zero (flang prints the zero) +! LZP = always print the optional leading zero +! LZS = suppress the optional leading zero +program leading_zero_format + implicit none + real :: val + + ! === LZP tests (print leading zero) === + ! F descriptor + write(*,'(A)') "LZP with F descriptor:" + write(*,'(LZP,F6.1)') 0.2 + write(*,'(LZP,F10.3)') 0.2 + write(*,'(LZP,F4.1)') 0.1 + + ! E descriptor + write(*,'(A)') "LZP with E descriptor:" + write(*,'(LZP,E10.3)') 0.2 + write(*,'(LZP,E12.5)') 0.2 + + ! D descriptor + write(*,'(A)') "LZP with D descriptor:" + write(*,'(LZP,D10.3)') 0.2d0 + + ! G descriptor (F-path: value in range) + write(*,'(A)') "LZP with G descriptor (F-path):" + write(*,'(LZP,G10.3)') 0.2 + + ! G descriptor (E-path: value out of range) + write(*,'(A)') "LZP with G descriptor (E-path):" + write(*,'(LZP,G10.3)') 0.0002 + + ! === LZS tests (suppress leading zero) === + ! F descriptor + write(*,'(A)') "LZS with F descriptor:" + write(*,'(LZS,F6.1)') 0.2 + write(*,'(LZS,F10.3)') 0.2 + write(*,'(LZS,F4.1)') 0.1 + + ! E descriptor + write(*,'(A)') "LZS with E descriptor:" + write(*,'(LZS,E10.3)') 0.2 + write(*,'(LZS,E12.5)') 0.2 + + ! D descriptor + write(*,'(A)') "LZS with D descriptor:" + write(*,'(LZS,D10.3)') 0.2d0 + + ! G descriptor (F-path) + write(*,'(A)') "LZS with G descriptor (F-path):" + write(*,'(LZS,G10.3)') 0.2 + + ! G descriptor (E-path) + write(*,'(A)') "LZS with G descriptor (E-path):" + write(*,'(LZS,G10.3)') 0.0002 + + ! === LZ tests (processor-defined, flang prints the zero) === + write(*,'(A)') "LZ with F descriptor:" + write(*,'(LZ,F6.1)') 0.2 + + ! === Negative values less than 1 === + write(*,'(A)') "Negative values:" + write(*,'(LZP,F7.1)') -0.2 + write(*,'(LZS,F7.1)') -0.2 + + ! === Values >= 1 (leading zero control has no effect) === + write(*,'(A)') "Values >= 1 (no effect):" + write(*,'(LZP,F6.1)') 1.2 + write(*,'(LZS,F6.1)') 1.2 + + ! === Zero value === + write(*,'(A)') "Zero value:" + write(*,'(LZP,F6.1)') 0.0 + write(*,'(LZS,F6.1)') 0.0 + + ! === Switching mid-format === + write(*,'(A)') "Switch mid-format:" + write(*,'(LZP,F6.1,LZS,F6.1)') 0.5, 0.5 + + ! === With 1P scale factor (no effect on leading zero) === + write(*,'(A)') "With 1P scale (no effect):" + write(*,'(LZP,1P,E10.3)') 0.2 + write(*,'(LZS,1P,E10.3)') 0.2 + + ! === Without comma separator === + write(*,'(A)') "Without comma separator:" + write(*,'(LZPF6.1)') 0.2 + write(*,'(LZSF6.1)') 0.2 + + ! === Spaces between characters of the edit descriptors === + write(*,'(A)') "Spaces in descriptors:" + write(*,'(L ZP,F6.1)') 0.2 + write(*,'(L ZS,F6.1)') 0.2 + write(*,'(LZ P,F6.1)') 0.2 + write(*,'(LZ S,F6.1)') 0.2 + write(*,'(L Z P,F6.1)') 0.2 + write(*,'(L Z S,F6.1)') 0.2 + write(*,'(L Z,F6.1)') 0.2 + write(*,'(L Z P,F6.1)') 0.2 + write(*,'(L Z S,F6.1)') 0.2 + +end program leading_zero_format diff --git a/Fortran/cray/f2023/13/08/leading_zero_format.reference_output b/Fortran/cray/f2023/13/08/leading_zero_format.reference_output new file mode 100644 index 000000000000..2f3ffce435d7 --- /dev/null +++ b/Fortran/cray/f2023/13/08/leading_zero_format.reference_output @@ -0,0 +1,56 @@ +LZP with F descriptor: + 0.2 + 0.200 + 0.1 +LZP with E descriptor: + 0.200E+00 + 0.20000E+00 +LZP with D descriptor: + 0.200D+00 +LZP with G descriptor (F-path): + 0.200 +LZP with G descriptor (E-path): + 0.200E-03 +LZS with F descriptor: + .2 + .200 + .1 +LZS with E descriptor: + .200E+00 + .20000E+00 +LZS with D descriptor: + .200D+00 +LZS with G descriptor (F-path): + .200 +LZS with G descriptor (E-path): + .200E-03 +LZ with F descriptor: + 0.2 +Negative values: + -0.2 + -.2 +Values >= 1 (no effect): + 1.2 + 1.2 +Zero value: + 0.0 + .0 +Switch mid-format: + 0.5 .5 +With 1P scale (no effect): + 2.000E-01 + 2.000E-01 +Without comma separator: + 0.2 + .2 +Spaces in descriptors: + 0.2 + .2 + 0.2 + .2 + 0.2 + .2 + 0.2 + 0.2 + .2 +exit 0 diff --git a/Fortran/cray/f2023/13/08/lit.local.cfg b/Fortran/cray/f2023/13/08/lit.local.cfg new file mode 100644 index 000000000000..116682026019 --- /dev/null +++ b/Fortran/cray/f2023/13/08/lit.local.cfg @@ -0,0 +1,2 @@ +config.traditional_output = True +config.single_source = True diff --git a/Fortran/cray/f2023/13/CMakeLists.txt b/Fortran/cray/f2023/13/CMakeLists.txt new file mode 100644 index 000000000000..8050e62ab740 --- /dev/null +++ b/Fortran/cray/f2023/13/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(08) diff --git a/Fortran/cray/f2023/CMakeLists.txt b/Fortran/cray/f2023/CMakeLists.txt index b6d8f8cb532a..31b1d84c492b 100644 --- a/Fortran/cray/f2023/CMakeLists.txt +++ b/Fortran/cray/f2023/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory(13) add_subdirectory(16)