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: InterpreterSeverity: 2 - Minor
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: John W. Eaton <jwe>
Originator Name: Pascal DupuisOpen/Closed: Open
Release: devOperating 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 File(s):
   
   
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 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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 16 May 2017 06:48:13 PM UTCmtmillerDependencies-=>bugs #50852 is dependent
    Tue 21 Mar 2017 05:05:34 AM UTCrik5Dependencies-=>bugs #50599 is dependent
    Thu 18 Feb 2016 05:08:33 AM UTCjweAssigned toNone=>jwe
    Wed 04 Feb 2015 04:35:48 AM UTCmtmillerSeverity3 - 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
    Fri 24 Jun 2011 04:29:53 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1