bugGNU Octave - Bugs: bug #38704, Incorrect braindead short...

 
 

bug #38704: Incorrect braindead short circuiting in m-files

Submitter:  None
Submitted:  Wed 10 Apr 2013 07:42:54 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Matthias Fuchs Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.3
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 11 Apr 2013 05:53:47 AM UTC, comment #5: 
John W. Eaton <jwe>
Group administrator
Wed 10 Apr 2013 08:11:20 PM UTC, comment #4: 

Ah, now I can reproduce that, thanks.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 10 Apr 2013 08:08:32 PM UTC, comment #3: 

It works when each of the lines in the example are entered in the interpreter. However, I still get an error in the second case if the example is saved as an .m file and the .m file is called from the interpreter.

Anonymous
Wed 10 Apr 2013 07:55:56 PM UTC, comment #2: 

Hmm, it works for me with 3.6.3:


octave:1> do_braindead_shortcircuit_evaluation (1)
octave:2> util = ~0, if util | [](:,1), 1, end
warning: possible Matlab-style short-circuit operator at line 2, column 20
util =  1
ans =  1
octave:3> if ~0 | [](:,1), 1, end
warning: possible Matlab-style short-circuit operator at line 3, column 7
ans =  1


John W. Eaton <jwe>
Group administrator
Wed 10 Apr 2013 07:50:06 PM UTC, comment #1: 

I can't reproduce this at 3.6.3. Are you sure this what you're seeing? Both work for me here.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 10 Apr 2013 07:42:54 PM UTC, original submission:  

I ran the following script with the octave interpreter and observed that the first if-expression is interpreted without error while the second one fails:


do_braindead_shortcircuit_evaluation (1)

% this works
util = ~0;
if util | [](:,1)
endif

% fails
if ~0 | [](:,1)
endif


In other words, it seems that in the latter case not only the first but also the second expression is evaluated which results in an error (index out of bounds). Unfortunately, I do not have access to Matlab so I do not know if this behavior is the same there.

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 rik5 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jordigh (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
    2013-04-11 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-04-10 jordigh StatusWorks For Me Confirmed
        SummaryInconsistent short-circuit behavior Incorrect braindead short circuiting in m-files
    2013-04-10 jordigh StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code