diff libinterp/dldfcn/__ode15__.cc @ 29445:b5f3ae7610cf

Use gnulib macros that account for the output type in integer overflow checks. * liboctave/wrappers/intprops-wrappers.c, intprops-wrappers.h: Use gnulib macro INT_MULTIPLY_WRAPV instead of INT_MULTIPLY_OVERFLOW. Change function prototypes accordingly * liboctave/util/lo-utils.cc, lo-utils.h (int_multiply_ok): Change function prototypes. * libinterp/dldfcn/__ode15__.cc (IDA::set_up): Adapt for changed function.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 16 Mar 2021 18:17:42 +0100
parents 7854d5752dd2
children 32c3a5805893
line wrap: on
line diff
--- a/libinterp/dldfcn/__ode15__.cc	Mon Mar 15 19:57:54 2021 +0100
+++ b/libinterp/dldfcn/__ode15__.cc	Tue Mar 16 18:17:42 2021 +0100
@@ -405,10 +405,11 @@
         // entries.
         m_sunJacMatrix = SUNSparseMatrix (m_num, m_num, 0, CSC_MAT);
 #    else
-        if (math::int_multiply_overflow (m_num, m_num))
+        octave_f77_int_type max_elems;
+        if (math::int_multiply_overflow (m_num, m_num, &max_elems))
           error ("Unable to allocate memory for sparse Jacobian");
 
-        m_sunJacMatrix = SUNSparseMatrix (m_num, m_num, m_num*m_num, CSC_MAT);
+        m_sunJacMatrix = SUNSparseMatrix (m_num, m_num, max_elems, CSC_MAT);
 #    endif
         if (! m_sunJacMatrix)
           error ("Unable to create sparse Jacobian for Sundials");