bugGNU Octave - Bugs: bug #43470, in place operation gives error:...

 
 

bug #43470: in place operation gives error: index out of bounds

Submitter:  None
Submitted:  Fri 24 Oct 2014 02:40:29 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  jwe
Originator Name:  Hartmut Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 29 Oct 2014 03:00:23 PM UTC, comment #9: 

@Hartmut: jwe applied the change to the gui-release branch which will be the new 4.0 release.  Given that this is a regression, this could be backported to the 3.8.X line and become part of a bugfix release 3.8.3.  However, I don't know how easy the backport would be, and I don't know if it would be worth it.  The 4.0 release isn't terribly far away and the maintainers may very well decide to release 4.0 rather than continuing the 3.8.X line.

Rik <rik5>
Group administrator
Wed 29 Oct 2014 07:39:35 AM UTC, comment #8: 

Thank you very much for your efforts in solving this problem.
I'm using in place operations frequently, also with variables defined in previous computations and loaded from file. However, the problem first came up with octave 3.8, in octave 3.4.3 for instance the test case works without any peculiarities or warnings, so the problem might be related to recent changes.

Hartmut <lada04>
Wed 29 Oct 2014 12:13:22 AM UTC, comment #7: 

@jwe: The test case in this bug report now passes.  I think you could close the report now.  Good parsers never segfault, but they might give strange warnings on very, very uncommon inputs (x += ...).  I think that is okay.

Rik <rik5>
Group administrator
Tue 28 Oct 2014 06:05:23 PM UTC, comment #6: 

I believe I've fixed the immediate problem with this changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/a3eead909bf9

There will still be a cryptic error message if the script (or a function) contains the lines


load x.mat
x +=...


This happens because the script (or function) is parsed completely prior to evaluation.  At that point, X is not known to be a variable, so the statement "x +=..." looks like a command so it is transformed to an indexing expression.  Later when it is evaluated, X is a variable, so the indexing expression succeeds, but the "+=" argument is transformed to a numeric argument to perform the indexing and the cryptic message about the index being out of range is generated.

One "solution" to this problem would be to change Octave so that the parser generates a "function call" in this instance instead of an "index expression" (which can be either a function call or a variable index).  Then the message would be something to the effect of "undefined function 'x'".

John W. Eaton <jwe>
Group administrator
Mon 27 Oct 2014 04:41:56 AM UTC, comment #5: 

Sorry, Rik is apparently right.  I'm not sure what I did earlier that led me to believe that the problem was fixed on default.  I'm now able to duplicate it.  It seems to be a bug in the parser.  I'll try to take a look at it.

John W. Eaton <jwe>
Group administrator
Mon 27 Oct 2014 04:22:26 AM UTC, comment #4: 

I've marked the bug as confirmed, and changed the Item Group to regression since this worked in 3.6.4.

The bad news is that I can still reproduce the bug on the development branch with cset a834b3151c7e (10/26/14).

Rik <rik5>
Group administrator
Fri 24 Oct 2014 10:53:24 PM UTC, comment #3: 

This problem is a bug in the parser.  It is mistakenly recognizing the x+=0 expression in this context as a "comamnd", so it is generating an index expression x ('+=0').  The good news is that the problem appears to already be fixed on the default branch of the Octave development sources.

John W. Eaton <jwe>
Group administrator
Fri 24 Oct 2014 10:18:28 PM UTC, comment #2: 

Disregard my previous comment, I now see where you assigned x and then saved the value to x.mat and I'm able to reproduce the problem.

John W. Eaton <jwe>
Group administrator
Fri 24 Oct 2014 10:07:27 PM UTC, comment #1: 

What is the value of X after loading the file x.mat?

John W. Eaton <jwe>
Group administrator
Fri 24 Oct 2014 02:40:29 PM UTC, original submission:  

after loading a variable from file, in place operations fail when executed inside a script. The same operation is returns correct results when given in an interactive shell.

Example:

user@lw035:~> cat script.m
load "x.mat"
x+=0

octave:1> version
ans = 3.8.2
octave:2> x=0
x = 0
octave:3> save "x.mat"
octave:4> clear
octave:5> script
error: script: A(I): index out of bounds; value 61 out of bound 1
error: called from:
error:   script.m at line 2, column 1
octave:5> x+=0
x = 0


Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lada04 (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (Submitted 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
    2014-11-10 rik5 Open/ClosedOpen Closed
    2014-10-29 rik5 StatusConfirmed Fixed
    2014-10-27 jwe Assigned toNone jwe
    2014-10-27 rik5 Item GroupNone Regression
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code