bugGNU Octave - Bugs: bug #59229, Regression in handling inf as...

 
 

bug #59229: Regression in handling inf as for-loop limits

Submitter:  None
Submitted:  Tue 06 Oct 2020 01:33:19 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 07 Feb 2021 11:24:11 PM UTC, comment #4: 

Verified it passes the test in tst_inf_loop.m.  Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Sat 06 Feb 2021 03:50:46 PM UTC, comment #3: 

I pushed the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/715344f405f0

Marking as ready for test.

John W. Eaton <jwe>
Group administrator
Thu 08 Oct 2020 05:44:06 PM UTC, comment #2: 

Yes, colon expressions that use Inf but have 0 elements should produce an empty matrix.  I'll look at fixing that.


John W. Eaton <jwe>
Group administrator
Wed 07 Oct 2020 08:26:11 PM UTC, comment #1: 

Confirmed.

I'm attaching an m-file (tst_inf_loop.m) which can be run to show the error.

This is related so I note it here


octave:1> x = Inf:0
error: out of memory or dimension too large for Octave's index type


In Octave 6.1 this just creates an empty matrix.



(file #49933)

Rik <rik5>
Group administrator
Tue 06 Oct 2020 01:33:19 PM UTC, original submission:  

This code used to work in Octave 5.2 but now causes an out of memory error in Octave 7.0.0 (dev):


lo = +inf;
hi = -inf;
# lo and hi are refined here as required by the problem instance
# If the instance is empty, then lo and hi are unchanged.
for i = lo:hi
  # do something
endfor
# The idea is that for empty problem instances,
# the for-loop would become empty as well and trivially backtrack.


This used to work as intended but now results in this error in Octave 7.0.0:

error: out of memory or dimension too large for Octave's index type


The problem is specific to the use of inf or -inf in for-loop limits, because the following loop does not cause an error:


lo = +1e30; # some value much bigger than memory would allow
hi = -1e30;
for i = lo:hi
  # do something
endfor
# Empty loop trivially exits.


The problem has been temporarily worked around by using a very large finite value instead of inf.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49933:  tst_inf_loop.m added by rik5 (68B - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-07 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-02-06 jwe StatusConfirmed Ready For Test
    2020-10-07 rik5 StatusNone Confirmed
    2020-10-07 rik5 Attached File- Added tst_inf_loop.m, #49933

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code