-
Notifications
You must be signed in to change notification settings - Fork 438
SetMaxNumSteps return codes are not checked (stale flag asserted) #5045
Copy link
Copy link
Closed
Description
- Type: Correctness / Error handling
- Severity: Medium
- Component: SUNDIALS integrator setup
- Location:
Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H:281Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H:355Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H:446
Problem
Calls to ARKStepSetMaxNumSteps do not assign their return value to flag, yet AMREX_ALWAYS_ASSERT(flag == 0) follows. The assert checks a stale value from a previous API call.
Impact
- Failure from
SetMaxNumStepscan pass unnoticed. - Setup can proceed with incorrect step-limit configuration.
Suggested patch
Capture and check each return code directly.
--- a/Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H
+++ b/Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H
@@
- ARKStepSetMaxNumSteps(arkode_mem, max_num_steps);
+ flag = ARKStepSetMaxNumSteps(arkode_mem, max_num_steps);
AMREX_ALWAYS_ASSERT(flag == 0);
@@
- ARKStepSetMaxNumSteps(arkode_fast_mem, max_num_steps);
+ flag = ARKStepSetMaxNumSteps(arkode_fast_mem, max_num_steps);
AMREX_ALWAYS_ASSERT(flag == 0);
@@
- ARKStepSetMaxNumSteps(arkode_mem, max_num_steps);
+ flag = ARKStepSetMaxNumSteps(arkode_mem, max_num_steps);
AMREX_ALWAYS_ASSERT(flag == 0);Prepared by Codex
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels