changeset 23467:0ada77ed24dd stable

use idx_type for dimensions instead of int (bug #50934) * ov-cell.cc (Fcell): Use octave_idx_type for dimensions. New test. * utils.cc (get_dimensions): Use octave_idx_type for dimensions.
author John W. Eaton <jwe@octave.org>
date Thu, 04 May 2017 10:03:26 -0400
parents 7eb0077e86f0
children f267a982478f 2f90ac754550
files libinterp/corefcn/utils.cc libinterp/octave-value/ov-cell.cc
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/utils.cc	Fri Apr 28 15:29:39 2017 -0400
+++ b/libinterp/corefcn/utils.cc	Thu May 04 10:03:26 2017 -0400
@@ -1116,7 +1116,7 @@
   if (! a.dims ().is_vector ())
     error ("%s (A): use %s (size (A)) instead", warn_for, warn_for);
 
-  const Array<int> v = a.int_vector_value ();
+  const Array<octave_idx_type> v = a.octave_idx_type_vector_value ();
   const octave_idx_type n = v.numel ();
 
   dim.resize (n); // even if n < 2, resize sets it back to 2
--- a/libinterp/octave-value/ov-cell.cc	Fri Apr 28 15:29:39 2017 -0400
+++ b/libinterp/octave-value/ov-cell.cc	Thu May 04 10:03:26 2017 -0400
@@ -1224,7 +1224,7 @@
 
         for (int i = 0; i < nargin; i++)
           dims(i) = (args(i).is_empty ()
-                     ? 0 : args(i).xnint_value ("cell: dimension must be a scalar integer"));
+                     ? 0 : args(i).xidx_type_value ("cell: dimension must be a scalar integer"));
       }
       break;
     }
@@ -1236,6 +1236,12 @@
   return ovl (Cell (dims));
 }
 
+/*
+## This might work on some system someday, but for now, who has a system
+## where a 16 yottabyte array can be allocated?  See bug #50934.
+%!error <out of memory> cell (1e24, 1);
+*/
+
 DEFUN (iscellstr, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {} iscellstr (@var{cell})