octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54414] Not recognizing that indices greater t


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54414] Not recognizing that indices greater than (roughly) 2^63 or 20 digits are too large
Date: Wed, 1 Aug 2018 12:46:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #3, bug #54414 (project octave):

That fixes this case, nice:


octave:2> zeros(9223372036854775807)
error: zeros: conversion to integer value failed


Yes, the error message could maybe be a little more helpful, but a little
thought and it should be evident what's wrong.  Here's the sort of hint the
gcc compiler displays:


  CXX      libinterp/corefcn/libinterp_corefcn_libcorefcn_la-oct-stream.lo
/linux/octave/octave/octave/libinterp/corefcn/oct-stream.cc:6610:55: warning:
integer constant is so large that it is unsigned
 std::cerr << "labs(-9223372036854775808) = " << labs(-9223372036854775808) <<
"


However, this change doesn't fix this example:


octave:2> fn = "ramp10by11.dat";
octave:3> fid = fopen(fn, "w+");
octave:4> fwrite (fid, ones(10,1)*[1:11], "single");frewind (fid);
octave:5> x = fread (fid, [9223372036854775807, 9223372036854775807],
'single');
octave:6> x
x = [](0x0)


The get_size() routine, after the recent change of Bug #54405, is doing its
own overflow check.  It's repetitive code, with conversions in both get_size()
and octave_idx_type_vector_value().  I feel the sooner test in the interpreter
is the better place to catch these.  However, that could mean noticeable
change in the variable holding that index information.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54414>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]