diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index 065f39e1b2..59dea2d019 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -95,6 +95,19 @@ if(ENABLE_ALL_WARNINGS) set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wextra -Wshadow -Wno-unused-parameter -Wno-unused-function ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Wextra -Wshadow -Wno-unused-parameter -Wno-unused-function ${CMAKE_CXX_FLAGS}") + + # TODO(DJG): Add -fcheck=all,no-pointer,no-recursion once Jenkins is updated + # to use gfortran > 5.5 which segfaults with -fcheck=array-temps,bounds,do,mem + # no- options were added in gfortran 6 + # + # Exclude run-time pointer checks (no-pointer) because passing null objects + # to SUNDIALS functions (e.g., sunmat => null() to SetLinearSolver) causes a + # run-time error with this check + # + # Exclude checks for subroutines and functions not marked as recursive + # (no-recursion) e.g., ark_brusselator1D_task_local_nls_f2003 calls + # SUNNonlinsolFree from within a custom nonlinear solver implementation of + # SUNNonlinsolFree which causes a run-time error with this check set(CMAKE_Fortran_FLAGS "-Wall -Wpedantic -Wno-unused-dummy-argument -Wno-c-binding-type -ffpe-summary=none ${CMAKE_Fortran_FLAGS}") endif() diff --git a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 index cc1e51b503..b0dbbadc20 100644 --- a/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 +++ b/examples/arkode/F2003_parallel/ark_brusselator1D_task_local_nls_f2003.f90 @@ -76,11 +76,11 @@ module ode_mod integer, parameter :: Nvar = 3 ! MPI variables - integer, target :: comm ! communicator - integer :: myid ! process ID - integer :: nprocs ! total number of processes - integer :: reqS ! MPI send request handle - integer :: reqR ! MPI receive request handle + integer, target :: comm ! communicator + integer :: myid ! process ID + integer :: nprocs ! total number of processes + integer :: reqS ! MPI send request handle + integer :: reqR ! MPI receive request handle ! Excahnge buffers real(c_double) :: Wsend(Nvar), Wrecv(Nvar) @@ -346,7 +346,6 @@ module prec_mod ! Preconditioner functions ! -------------------------------------------------------------- - ! Sets P = I - gamma * J integer(c_int) function PSetup(t, sunvec_y, sunvec_f, jok, jcurPtr, gamma, & user_data) result(ierr) bind(C) @@ -462,7 +461,6 @@ integer(c_int) function PSolve(t, sunvec_y, sunvec_f, sunvec_r, sunvec_z, & !======= Inclusions =========== use, intrinsic :: iso_c_binding - use fnvector_mpiplusx_mod !======= Declarations ========= @@ -758,7 +756,6 @@ integer(SUNNonlinearSolver_Type) function TaskLocalNewton_GetType(sunnls) & !======= Inclusions =========== use, intrinsic :: iso_c_binding - !======= Declarations ========= implicit none @@ -778,7 +775,6 @@ integer(c_int) function TaskLocalNewton_Initialize(sunnls) & !======= Inclusions =========== use, intrinsic :: iso_c_binding - !======= Declarations ========= implicit none @@ -817,8 +813,6 @@ integer(c_int) function TaskLocalNewton_Solve(sunnls, sunvec_y0, sunvec_ycor, & !======= Inclusions =========== use, intrinsic :: iso_c_binding - - use fnvector_mpiplusx_mod use ode_mod, only : comm @@ -880,10 +874,6 @@ integer(c_int) function TaskLocalNewton_Free(sunnls) & !======= Inclusions =========== use, intrinsic :: iso_c_binding - - - - !======= Declarations ========= implicit none @@ -911,7 +901,6 @@ integer(c_int) function TaskLocalNewton_SetSysFn(sunnls, SysFn) & !======= Inclusions =========== use, intrinsic :: iso_c_binding - !======= Declarations ========= implicit none @@ -932,7 +921,6 @@ integer(c_int) function TaskLocalNewton_SetConvTestFn(sunnls, CTestFn, & !======= Inclusions =========== use, intrinsic :: iso_c_binding - !======= Declarations ========= implicit none @@ -954,7 +942,6 @@ integer(c_int) function TaskLocalNewton_GetNumConvFails(sunnls, nconvfails) & !======= Inclusions =========== use, intrinsic :: iso_c_binding - !======= Declarations ========= implicit none @@ -976,9 +963,7 @@ function TaskLocalNewton(arkode_mem, sunvec_y) result(sunnls) !======= Inclusions =========== use, intrinsic :: iso_c_binding - use fnvector_serial_mod - use fsunnonlinsol_newton_mod use fsunlinsol_dense_mod use fsunmatrix_dense_mod @@ -995,7 +980,7 @@ function TaskLocalNewton(arkode_mem, sunvec_y) result(sunnls) type(SUNNonlinearSolver), pointer :: sunnls ! SUNDIALS nonlinear solver type(SUNNonlinearSolver_Ops), pointer :: nlsops ! solver operations - integer :: ierr ! MPI error status + integer :: ierr ! MPI error status !======= Internals ============ @@ -1258,6 +1243,9 @@ subroutine EvolveProblemIMEX(sunvec_y) end if ! Create the (non)linear solver + sun_NLS => null() + sun_LS => null() + if (global) then ! Create nonlinear solver @@ -1948,6 +1936,7 @@ subroutine ExchangeAllEnd() !======= Inclusions =========== use, intrinsic :: iso_c_binding + use ode_mod, only : comm, reqS, reqR, c !======= Declarations ========= @@ -1983,9 +1972,6 @@ subroutine SetupProblem() !======= Inclusions =========== use, intrinsic :: iso_c_binding - - - use fnvector_serial_mod use fnvector_mpiplusx_mod use fnvector_mpimanyvector_mod @@ -2252,6 +2238,7 @@ subroutine FreeProblem() !======= Inclusions =========== use, intrinsic :: iso_c_binding use fsundials_core_mod + use ode_mod, only : sunctx, logger, myid, nout, umask_s, umask, vmask, wmask !======= Declarations ========= diff --git a/test/env/default.sh b/test/env/default.sh index 3085490055..6fdf276cf3 100644 --- a/test/env/default.sh +++ b/test/env/default.sh @@ -139,10 +139,6 @@ if [ "$compilername" == "gcc" ]; then export CUDAFLAGS="-g -O3" fi - # TODO(CJB): add this back after we upgrade the GNU compiler stack on the Jenkins box - # Currently this causes the compiler to segfault on many of the Fortran example codes. - # export FFLAGS="${FFLAGS} -fbounds-check" - else COMPILER_ROOT="$(spack location -i "llvm@$compilerversion")" diff --git a/test/env/docker.sh b/test/env/docker.sh index 2f9359af0d..105f5aaedc 100644 --- a/test/env/docker.sh +++ b/test/env/docker.sh @@ -109,12 +109,8 @@ if [ "$compilername" == "gcc" ]; then export CUDAFLAGS="-g -O3" fi - # append additional warning flags - if [[ "$SUNDIALS_PRECISION" == "double" && "$SUNDIALS_INDEX_SIZE" == "32" ]]; then - export CFLAGS="${CFLAGS} -Wconversion -Wno-sign-conversion" - export CXXFLAGS="${CXXFLAGS} -Wconversion -Wno-sign-conversion" - fi - + # additional Fortran flags not currently added by ENABLE_ALL_WARNINGS + export FFLAGS="${FFLAGS} -fcheck=all,no-pointer,no-recursion" fi # ------------------------------------------------------------------------------