octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64213] crash while using subsasgn with struct


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #64213] crash while using subsasgn with struct and multiple subs value
Date: Fri, 28 Jul 2023 03:03:12 -0400 (EDT)

Update of bug #64213 (project octave):

              Item Group:                    None => Segfault, Bus Error, etc.
                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #2:

If I understand the reproducer correctly, it is an elaborate way to write:

o = struct();
o.({"Vipul", "Cariappa", "N", "T"}) = 3


Indexing a structure with a cell array doesn't work. And the above syntax
correctly displays an error message:

>> o = struct();
>> o.({"Vipul", "Cariappa", "N", "T"}) = 3
error: dynamic structure field names must be strings


I don't know what the original intent of that function is. But guessing from
the function name, it might be something like the following:

nested_fields = {"Vipul", "Cariappa", "N", "T"};
idx = struct('type', '.', 'subs', nested_fields);

o = struct ();
o = subsasgn (o, idx, 3);


But I agree that Octave shouldn't crash but preferably emit an error message
similar to the "simpler" syntax.

Reducing the reproducer:

nested_fields = {"Vipul", "Cariappa", "N", "T"};
idx = struct('type', '.', 'subs', {nested_fields});

o = struct ();
o = subsasgn (o, idx, 3);





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64213>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]