[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rethinking octave_idx_type
From: |
John W. Eaton |
Subject: |
Re: Rethinking octave_idx_type |
Date: |
Mon, 28 Nov 2016 08:28:51 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
On 11/28/2016 07:54 AM, John W. Eaton wrote:
The first step is to use F77_INT instead of octave_idx_type to declare
integer variables that are passed to Fortran functions.
We can also get some help from GCC to identify where there are issues
when working on this step.
If we define F77_INT to be 32 bits wide and octave_idx_type to be 64
bits wide and compile with -Wconversion, we should see errors anywhere
there are pointer mismatches and warnings about passing octave_idx_type
where F77_INT is expected. See the attached program, for example. I
know from experience that -Wconversion leads to a LOT of noise in the
output from the compiler when building Octave, but the warnings from
recent versions of GCC use the typedef names so it should be easy to
filter the messages and find only the places where F77_INT is affected.
We should already be using F77_INT for the function declarations of any
Fortran code used by Octave so it should be fairly straightforward to
find all the locations that are affected.
Then we need a function to convert octave_idx_type to F77_INT and check
for possible overflow. For example, to safely extract the number of
rows from a matrix that will be passed to a Fortran subroutine we would
use something like this
// May error if A is too large for our Fortran libraries.
F77_INT nr = to_f77_int (A.rows ());
instead of just
F77_INT nr = A.rows ();
jwe
sizes.cc
Description: Text Data
- Re: Rethinking octave_idx_type, (continued)
- Re: Rethinking octave_idx_type, Philip Nienhuis, 2016/11/25
- Re: Rethinking octave_idx_type, Rik, 2016/11/25
- Re: Rethinking octave_idx_type, Daniel J Sebald, 2016/11/26
- Re: Rethinking octave_idx_type, Mike Miller, 2016/11/26
- Re: Rethinking octave_idx_type, John W. Eaton, 2016/11/26
- Re: Rethinking octave_idx_type, Rik, 2016/11/26
- Re: Rethinking octave_idx_type, John W. Eaton, 2016/11/28
- Re: Rethinking octave_idx_type,
John W. Eaton <=
- Re: Rethinking octave_idx_type, Rik, 2016/11/28
- Re: Rethinking octave_idx_type, Carnë Draug, 2016/11/28
- Re: Rethinking octave_idx_type, Rik, 2016/11/28
- Re: Rethinking octave_idx_type, John W. Eaton, 2016/11/28
- Re: Rethinking octave_idx_type, John W. Eaton, 2016/11/28