bugGNU Octave - Bugs: bug #33637, Misleading "invalid use of...

 
 

bug #33637: Misleading "invalid use of end" error message

Submitted by:  Pascal Dupuis <cdemills>
Submitted on:  Fri 24 Jun 2011 02:24:17 PM UTC  
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  John W. Eaton <jwe>
Originator Name:  Pascal Dupuis Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 19 Nov 2016 03:16:01 PM UTC, comment #3:

This behavior is still present in Octave 4.2.0.

Hartmut <hardy>
Thu 18 Feb 2016 05:08:33 AM UTC, comment #2:

Yes, but you'll get a similar result if you try to index an undefined variable with an undefined variable:

The reason the complaint is about the index instead of the object that is being indexed is because Octave evaluates the argument list first, then looks up the symbol.

However, for the end keyword, we have to first determine the value of the object that is being indexed, so we can determine what "end" means.

So I suppose we could error at that point with a message that says the object is invalid. I'll try to take a look at this.

John W. Eaton <jwe>
Project AdministratorIn charge of this item.
Fri 24 Jun 2011 04:29:53 PM UTC, comment #1:

Confirmed. Here is simpler code to reproduce the error, assuming matrix a is undefined.

Rik <rik5>
Project Administrator
Fri 24 Jun 2011 02:24:17 PM UTC, original submission:

Hello,

I introduced the following typo in a function code:
if (length(varargin) > 1)
some_par = varargin(1);
varargin = varagin(2:end) % <= notice the typo
else
some_par = ones(size(x));
endif

This generate the following error message:
"invalid use of end"

The problem is that there is obviously no varagin variable. Could the error clearly point to the fact that the variable associated with the 'end' keyword does not exist, and not about the use of end itself?

Regards

Pascal

Pascal Dupuis <cdemills>
Project Member

 

(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

Digest:
   bug dependencies.

 

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

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

    Only project members can vote.

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-16 mtmiller Dependencies- => bugs #50852 is dependent
    2017-03-21 rik5 Dependencies- => bugs #50599 is dependent
    2016-02-18 jwe Assigned toNone => jwe
    2015-02-04 mtmiller Severity3 - Normal => 2 - Minor
        Item GroupInaccurate Result => Incorrect Result
        Release3.4.1 => dev
        Operating SystemGNU/Linux => Any
        SummaryMisleading "Incorrect use of end" message => Misleading "invalid use of end" error message
    2011-06-24 rik5 StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.3