bugGNU Octave - Bugs: bug #51785, Inconsistent behavior of various...

 
 

bug #51785: Inconsistent behavior of various shaped empty index vectors in for loops

Submitter:  Geoffrey Adams <biogeo>
Submitted:  Fri 18 Aug 2017 05:52:06 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Geoffrey Adams Open/Closed:  * Closed
Release:  * 4.0.3 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Fri 18 Aug 2017 06:05:44 PM UTC, comment #1: 

Thanks for your bug report. This looks like it covers the same ground as bug #50893, which has already been fixed on the default branch. Indeed your last example does work correctly on Octave's default branch. So this will be working correctly in Octave's 4.4 release.

Mike Miller <mtmiller>
Group Member
Fri 18 Aug 2017 05:52:06 PM UTC, original submission:  

When supplying an empty matrix as the index vector to a for loop, the expected behavior is that the loop body is skipped, as in the following:


for i=[]
    disp('This will never execute');
end


However, for empty matrices that are not shaped as 0-by-0, this is not always the case. In particular, while the following behaves as expected:


for i=reshape([],1,0)
    disp('This will never execute');
end


the following does not:


for i=reshape([],0,1)
    disp('This line executes, and i is a 0-by-1 matrix');
    disp(i);
end


Geoffrey Adams <biogeo>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

Digest:
   bug dependencies.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by biogeo (Submitted the item)
  •  

    Votes

    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.

     

    History

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-18 mtmiller Dependencies- Depends on bugs #50893
    2017-08-18 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.16-ed84.
    Corresponding source code