diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b1a767..4322e0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,12 @@ set(BLAS_TESTS set(LAPACK_TESTS rand_mat_svd_test) +set(CMAKE_Fortran_STANDARD 2008) +set(FVERSION "-std=f2008 -cpp") +set(FLAGS1 "-Wall -Wextra -Wpedantic") +#set(WERROR "-Werror") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${FVERSION} ${FLAGS1} ${WERROR}") + # We now create the c wrapper that handles command line arguments for testing. # The xxx_main.c files are generated by CMake. # The test functions are forward declared with extern. diff --git a/blas_test.f90 b/blas_test.f90 index 5a72c50..0ae2f5d 100644 --- a/blas_test.f90 +++ b/blas_test.f90 @@ -4,27 +4,28 @@ module blas_test_mod implicit none contains -integer function saxpy_test() result(ret) bind(C) +integer(c_int) function saxpy_test() result(ret) bind(C) real :: x(2), y(2) data x/0.0, 2.0/, y/1.0, 0.0/ - + real :: tol = 1e-5 call saxpy(2, 2.0, x, 1, y, 1) - if (y(1) == 1.0 .and. y(2) == 4.0) then + if (abs(y(1) - 1.0) < tol .and. abs(y(2) - 4.0) < tol) then ret = 0 else ret = 1 end if end function saxpy_test -integer function sgemv_test() result(ret) bind(C) +integer(c_int) function sgemv_test() result(ret) bind(C) real :: matrix(2, 2), vector(2) data matrix/1.0, 0.0, 0.0, 1.0/, vector/1.0, 2.0/ real :: y(2) + real :: tol = 1e-5 call sgemv('n', 2, 2, 2.0, matrix, 2, vector, 1, 0.0, y, 1) - if (y(1) == 2.0 .and. y(2) == 4.0) then + if (abs(y(1) - 2.0) < tol .and. abs(y(2) - 4.0) < tol) then ret = 0 else ret = 1 diff --git a/lapack_test.f90 b/lapack_test.f90 index 821fb05..513b275 100644 --- a/lapack_test.f90 +++ b/lapack_test.f90 @@ -5,9 +5,9 @@ module lapack_test_mod contains function rand_mat_svd_test() result(ret) bind(C) - integer :: ret + integer(c_int) :: ret integer :: iseed(4) - integer :: info, lwork, allocstat, i + integer :: info, lwork, allocstat real :: mat(8, 8), s(8), dummy_u, dummy_vt, qwork(1) real, allocatable :: work(:)