bugGNU Octave - Bugs: bug #49028, Selecting items from a struct...

 
 

bug #49028: Selecting items from a struct array without the first element produces garbage

Submitter:  None
Submitted:  Thu 08 Sep 2016 01:53:11 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Pekka Paalanen Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 08 Sep 2016 02:19:18 PM UTC, comment #2: 

After discussion on IRC, closing as invalid.

Carnë Draug <carandraug>
Group Member
Thu 08 Sep 2016 02:14:55 PM UTC, comment #1: 

The issue seems to be there on development version as well.  The issue seems to be on logical indexing a struct array when one of the elements is empty:


octave> p = struct ();
octave> p(2).channel = "A";
octave> p(3).channel = "B";
octave> p(4).channel = "C";
octave> [p.channel]
ans = ABC  ## note that this does not include the empty value
octave> [p.channel] == "B" ## so the indexing array is missing the first element
ans =

  0  1  0


I'm thinking this may not be a bug after all.

Carnë Draug <carandraug>
Group Member
Thu 08 Sep 2016 01:53:11 PM UTC, original submission:  

See the attached script for an repeatable test case. I would expect it to print a series of 'B' characters, but it prints instead e.g.
ans = ACBBCBBCBBACABBBAACBACAABBBAAAAC

This happens only when the first element of the struct array is not set.

I wrote this on octave 3.8.2, but JordiGH on #octave said it is also happening on 4.0.3. He may or may not have taken a look at fixing it.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38449:  struct_array_nul_bug.m added by None (601B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-08 carandraug StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2016-09-08 None Attached File- Added struct_array_nul_bug.m, #38449

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code