bugGNU Octave - Bugs: bug #36003, misleading error for assignment to...

 
 

bug #36003: misleading error for assignment to empty structure

Submitter:  Ben Abbott <bpabbott>
Submitted:  Mon 26 Mar 2012 12:12:00 AM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Ben Abbott Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 06 Feb 2018 06:40:04 PM UTC, comment #7: 

@Joe: I added you to list of contributors here (http://hg.savannah.gnu.org/hgweb/octave/rev/fa56428a2e91).

Rik <rik5>
Group administrator
Tue 06 Feb 2018 06:16:18 PM UTC, comment #6: 

Thanks @Rik. I didn't know about make check, I'll try to remember to try that next time.
As far as being a contributor, I didn't do a whole lot for this one, but if it counts and isn't too much effort to add then sure I'd be glad to be listed.

Joe Winegarden <wino>
Tue 06 Feb 2018 06:05:41 PM UTC, comment #5: 

I checked in the changeset here (http://hg.savannah.gnu.org/hgweb/octave/rev/2ce26c4cb323).

Since this was from a new contributor, I'll document the changes I made to the patch before committing.

1) In order not to violate Matlab copyright I did not copy their error message verbatim.  Besides, I still felt it was a little unclear.  Instead, I used this,


  error ("invalid dot name structure assignment because the structure array is empty.  Specify a subscript on the structure array to resolve.");


2) The functions in errwarn.h and errwarn.cc have no logical order so they are listed in alphabetical order as being the least bad organizational principle.  I put your new function in to correct alphabetic order in both files.

3) When using 'make check' to run the test suite I discovered that there was now a test failure.  The failure was due to the fact that the test was looking specifically for the old error message.  I changed the test to match the new message and now the test suite is passing without regressions.

@Joe: If you would like to be listed in the Octave manual as a contributor to Octave just let me know.  The list of contributors appears in the preface section of the manual.

Rik <rik5>
Group administrator
Tue 23 Jan 2018 10:14:43 PM UTC, comment #4: 

This is my first contribution so not sure if I did it entirely right, but changeset attached. I'm also unsure if my fix is too naive, i.e. are there conditions under which this is not the right message that need to be distinguished, or how to write a test(s) for it.

Joe Winegarden <wino>
Sat 19 Nov 2016 09:10:46 PM UTC, comment #3: 

This is still the same in Octave 4.2.0.

Hartmut <hardy>
Fri 26 Feb 2016 04:55:33 AM UTC, comment #2: 

Mike's post seemed to be truncated.  The full Matlab error is


A dot name structure assignment is illegal when the structure is empty.  Use a subscript on the structure.


(In case the verbatim environment caused the problem, it is: "A dot name structure assignment is illegal when the structure is empty.  Use a subscript on the structure.")

Lachlan Andrew <lachlan>
Sat 16 May 2015 07:05:54 PM UTC, comment #1: 

Confirmed, here is the Matlab error message for reference in case someone wants to add something similar:


A dot name structure assignment is illegal when the structure is empty. Use a subscript on the structure.


Mike Miller <mtmiller>
Group Member
Mon 26 Mar 2012 12:12:00 AM UTC, original submission:  

This seems to come up a lot on mail-list.


octave:2> s = struct ("a", {}, "b", 0)
s =
 0x0 struct array containing the fields:
   a
   b
octave:2> s.b = 65
error: invalid assignment to cs-list outside multiple assignment


When a subscript is included on the structure, there is no error.


octave:3> s(1).b = 65
s =

  scalar structure containing the fields:

    a = [](0x0)
    b =  65


Can something be done to give a more descriptive error message?

Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #43041:  36003.cset added by wino (2KiB - application/octet-stream - changeset to fix this bug)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by wino (Updated the item)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by bpabbott (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-02-06 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-01-23 wino Attached File- Added 36003.cset, #43041
    2015-05-16 mtmiller Priority5 - Normal 3 - Low
        StatusDuplicate Confirmed
    2014-01-28 mtmiller StatusNone Duplicate
        Dependencies- Depends on bugs #34967
    2012-03-26 bpabbott Summarymisleading error message misleading error for assignment to empty structure

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code