Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
compiler: [gfortran-7, gfortran-8, gfortran-9]
compiler: [gfortran-8, gfortran-9, gfortran-10]

steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 21 additions & 2 deletions test/test_map.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ end function xpowx_c16
end module mod_map_functions

program test_map
use iso_fortran_env, only:int8, int16, int32, int64, real32, real64, real128
use iso_fortran_env, only:int8, int16, int32, int64, real32, real64, real128, compiler_version, compiler_options
use testing, only:assert, initialize_tests, report_tests
use functional
use mod_map_functions
Expand All @@ -75,6 +75,11 @@ program test_map
complex(real64), dimension(:), allocatable :: c8
complex(real128), dimension(:), allocatable :: c16

character(len=100) :: s_compiler_version
logical :: compiler_has_O3
complex(real32), dimension(:), allocatable :: c4res
logical :: c4rescheck

n = 1
ntests = 10
call initialize_tests(tests, ntests)
Expand Down Expand Up @@ -115,7 +120,21 @@ program test_map
cmplx(2._real128, 0._real128), &
cmplx(3._real128, 0._real128)]

tests(n) = assert(all(map(xpowx_c4, c4) == c4**c4), 'map, complex real32')
! Special case for gfortran-10 with -O3 if detected
c4rescheck = all(map(xpowx_c4, c4) == c4**c4) ! the default
s_compiler_version = compiler_version() ! e.g., `GCC version {major}.{minor}.{patch}`
compiler_has_O3 = index(compiler_options(), '-O3') /= 0
if ( &
s_compiler_version(1:3) == 'GCC' &
.and. s_compiler_version(13:14) == '10' &
.and. compiler_has_O3 &
) then
print *, 'using special check for gfortran-10 -O3 for complex real32'
! Note: `x = map(xpowx_c4, c4) == c4**c4` is T T F (via `print *, x`) even though `map(xpowx_c4, c4) == c4**c4` is T T T
c4res = map(xpowx_c4, c4)
c4rescheck = all(c4res == c4**c4) ! by assigning `c4res` first we are able to get T T T in the comparison
end if
tests(n) = assert(c4rescheck, 'map, complex real32')
n = n + 1

tests(n) = assert(all(map(xpowx_c8, c8) == c8**c8), 'map, complex real64')
Expand Down