diff --git a/Fortran/UnitTests/CMakeLists.txt b/Fortran/UnitTests/CMakeLists.txt index 84979dd70f..a8e17338a1 100644 --- a/Fortran/UnitTests/CMakeLists.txt +++ b/Fortran/UnitTests/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(hello) add_subdirectory(fcvs21_f95) # NIST Fortran Compiler Validation Suite add_subdirectory(finalization) +add_subdirectory(assumed-rank) diff --git a/Fortran/UnitTests/assumed-rank/CMakeLists.txt b/Fortran/UnitTests/assumed-rank/CMakeLists.txt new file mode 100644 index 0000000000..8b9f2da57c --- /dev/null +++ b/Fortran/UnitTests/assumed-rank/CMakeLists.txt @@ -0,0 +1,3 @@ +llvm_singlesource() + +file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.f90 b/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.f90 new file mode 100644 index 0000000000..dfc81ffcb4 --- /dev/null +++ b/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.f90 @@ -0,0 +1,69 @@ +program rank_dummy_select_intrinsic + implicit none + integer a, a1(1), a2(1,1), a3(1,1,1), a4(1,1,1, 1), a5(1,1,1, 1,1), a6(1,1,1, 1,1,1), a7(1,1,1, 1,1,1, 1) + integer a8(1,1,1, 1,1,1, 1,1), a9(1,1,1, 1,1,1, 1,1,1), a10(1,1,1, 1,1,1, 1,1,1, 1), a11(1,1,1, 1,1,1, 1,1,1, 1,1) + integer a12(1,1,1, 1,1,1, 1,1,1, 1,1,1), a13(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1), a14(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1) + integer a15(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1) + + call print_rank(a) + call print_rank(a1) + call print_rank(a2) + call print_rank(a3) + call print_rank(a4) + call print_rank(a5) + call print_rank(a6) + call print_rank(a7) + call print_rank(a8) + call print_rank(a9) + call print_rank(a10) + call print_rank(a11) + call print_rank(a12) + call print_rank(a13) + call print_rank(a14) + call print_rank(a15) + +contains + + subroutine print_rank(a) + integer a(..) + character(len=*), parameter :: format_='(a,i2)' + + select rank(a) + rank(0) + print format_,"rank(a) = ",rank(a) + rank(1) + print format_,"rank(a) = ",rank(a) + rank(2) + print format_,"rank(a) = ",rank(a) + rank(3) + print format_,"rank(a) = ",rank(a) + rank(4) + print format_,"rank(a) = ",rank(a) + rank(5) + print format_,"rank(a) = ",rank(a) + rank(6) + print format_,"rank(a) = ",rank(a) + rank(7) + print format_,"rank(a) = ",rank(a) + rank(8) + print format_,"rank(a) = ",rank(a) + rank(9) + print format_,"rank(a) = ",rank(a) + rank(10) + print format_,"rank(a) = ",rank(a) + rank(11) + print format_,"rank(a) = ",rank(a) + rank(12) + print format_,"rank(a) = ",rank(a) + rank(13) + print format_,"rank(a) = ",rank(a) + rank(14) + print format_,"rank(a) = ",rank(a) + rank(15) + print format_,"rank(a) = ",rank(a) + rank default + error stop "unrecognized rank" + end select + end subroutine + +end program rank_dummy_select_intrinsic diff --git a/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.reference_output b/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.reference_output new file mode 100644 index 0000000000..dc0acd6ab5 --- /dev/null +++ b/Fortran/UnitTests/assumed-rank/dummy-select-intrinsic.reference_output @@ -0,0 +1,17 @@ +rank(a) = 0 +rank(a) = 1 +rank(a) = 2 +rank(a) = 3 +rank(a) = 4 +rank(a) = 5 +rank(a) = 6 +rank(a) = 7 +rank(a) = 8 +rank(a) = 9 +rank(a) = 10 +rank(a) = 11 +rank(a) = 12 +rank(a) = 13 +rank(a) = 14 +rank(a) = 15 +exit 0 diff --git a/Fortran/UnitTests/assumed-rank/lit.local.cfg b/Fortran/UnitTests/assumed-rank/lit.local.cfg new file mode 100644 index 0000000000..1166820260 --- /dev/null +++ b/Fortran/UnitTests/assumed-rank/lit.local.cfg @@ -0,0 +1,2 @@ +config.traditional_output = True +config.single_source = True