Skip to content

Commit

Permalink
Merge branch 'develop' into feature/logging-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 authored Dec 6, 2024
2 parents 48f73ec + f7208a4 commit be777dd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
39 changes: 30 additions & 9 deletions cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,39 @@ if(ENABLE_WARNINGS_AS_ERRORS)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Werror")
endif()

# With clang it is not possible to combine the -fsanitize=address and
# -fsanitize=memory checkers.

if(ENABLE_ADDRESS_SANITIZER)
message(STATUS "Enabling address sanitizer")

set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined"
)
set(CMAKE_Fortran_FLAGS
"${CMAKE_Fortran_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined"
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=address")
endif()

if(ENABLE_MEMORY_SANITIZER)
message(STATUS "Enabling memory sanitizer")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=memory")
endif()

if(ENABLE_LEAK_SANITIZER)
message(STATUS "Enabling leak sanitizer")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=leak")
endif()

if(ENABLE_UNDEFINED_BEHAVIOR_SANITIZER)
message(STATUS "Enabling undefined behavior sanitizer")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fsanitize=undefined")
endif()

if(SUNDIALS_DEBUG)
Expand Down
2 changes: 2 additions & 0 deletions src/arkode/arkode_mri_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,8 @@ int mriStepCoupling_GetStageType(MRIStepCoupling MRIC, int is)

if ((is < 0) || (is > MRIC->stages)) { return ARK_INVALID_TABLE; }

if (is == 0) { return MRISTAGE_FIRST; }

/* report MRISTAGE_ERK_FAST for MERK and MRI-SR methods */
if ((MRIC->type == MRISTEP_SR) || (MRIC->type == MRISTEP_MERK))
{
Expand Down
1 change: 1 addition & 0 deletions src/arkode/arkode_mristep_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern "C" {
#endif

/* Stage type identifiers */
#define MRISTAGE_FIRST -2
#define MRISTAGE_STIFF_ACC -1
#define MRISTAGE_ERK_FAST 0
#define MRISTAGE_ERK_NOFAST 1
Expand Down

0 comments on commit be777dd

Please sign in to comment.