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

 
 

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

Submitted by:  None
Submitted on:  Fri 24 Oct 2014 02:40:29 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: John W. Eaton <jwe>
Originator Name: HartmutOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.2
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project 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>
Project 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

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by lada04 (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 10 Nov 2014 04:19:41 AM UTCrik5Open/ClosedOpen=>Closed
    Wed 29 Oct 2014 12:13:22 AM UTCrik5StatusConfirmed=>Fixed
    Mon 27 Oct 2014 04:41:56 AM UTCjweAssigned toNone=>jwe
    Mon 27 Oct 2014 04:22:26 AM UTCrik5Item GroupNone=>Regression
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1