From 3b3550d247e9405da5a79aed6fc8ac4836370466 Mon Sep 17 00:00:00 2001 From: Pratyai Mazumder Date: Wed, 6 Nov 2024 15:42:54 +0100 Subject: [PATCH] Another corrected test program: This one was trying to assign logical values into real array, which `gfortran` doesn't like. So, changed the array type into logical (and same on the external numpy array too). --- tests/fortran/fortran_language_test.py | 55 +++++++++++++------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/tests/fortran/fortran_language_test.py b/tests/fortran/fortran_language_test.py index 32ab23714b..36396bce90 100644 --- a/tests/fortran/fortran_language_test.py +++ b/tests/fortran/fortran_language_test.py @@ -91,35 +91,35 @@ def test_fortran_frontend_loop1(): """ Tests that the loop construct is correctly parsed and translated to DaCe. """ - - test_string = """ - PROGRAM loop1_test - implicit none - double precision d(3,4,5) - CALL loop1_test_function(d) - end - SUBROUTINE loop1_test_function(d) - double precision d(3,4,5),ZFAC(10) - INTEGER :: a, JK, JL,JM - INTEGER, PARAMETER :: KLEV=10, N=10,NCLV=3 - - double precision :: RLMIN,ZVQX(NCLV) - LOGICAL :: LLCOOLJ,LLFALL(NCLV) - LLFALL(:)= .FALSE. - ZVQX(:)= 0.0 - ZVQX(2)= 1.0 - DO JM=1,NCLV - IF (ZVQX(JM)>0.0) LLFALL(JM)=.TRUE. ! falling species - ENDDO - - d(1,1,1)=LLFALL(1) - d(1,1,2)=LLFALL(2) - END SUBROUTINE loop1_test_function - """ + test_string = """ +program loop1_test + implicit none + logical :: d(3, 4, 5) + call loop1_test_function(d) +end + +subroutine loop1_test_function(d) + logical :: d(3, 4, 5), ZFAC(10) + integer :: a, JK, JL, JM + integer, parameter :: KLEV = 10, N = 10, NCLV = 3 + + double precision :: RLMIN, ZVQX(NCLV) + logical :: LLCOOLJ, LLFALL(NCLV) + LLFALL(:) = .false. + ZVQX(:) = 0.0 + ZVQX(2) = 1.0 + do JM = 1, NCLV + if (ZVQX(JM) > 0.0) LLFALL(JM) = .true. ! falling species + end do + + d(1, 1, 1) = LLFALL(1) + d(1, 1, 2) = LLFALL(2) +end subroutine loop1_test_function +""" sdfg = fortran_parser.create_sdfg_from_string(test_string, "loop1_test") sdfg.simplify(verbose=True) - d = np.full([3, 4, 5], 42, order="F", dtype=np.float64) + d = np.full([3, 4, 5], np.True_, order="F", dtype=np.bool_) sdfg(d=d) assert (d[0, 0, 0] == 0) assert (d[0, 0, 1] == 1) @@ -196,7 +196,7 @@ def test_fortran_frontend_pow2(): """ Tests that the power intrinsic is correctly parsed and translated to DaCe (this time it's p sqrt p). """ - + test_string = """ PROGRAM pow2_test implicit none @@ -253,7 +253,6 @@ def test_fortran_frontend_sign1(): if __name__ == "__main__": - test_fortran_frontend_real_kind_selector() test_fortran_frontend_if1() test_fortran_frontend_loop1()