[bug #68465] Unexpected error when calling squeeze on array of structures

merlea <[email protected]> Mon, 22 Jun 2026 11:11:30 -0400 (EDT)
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

URL:
  <https://savannah.gnu.org/bugs/?68465>

                 Summary: Unexpected error when calling squeeze on array of
structures
                   Group: GNU Octave
               Submitter: merlea
               Submitted: lun. 22 juin 2026 15:11:20
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: 8.4.0
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: lun. 22 juin 2026 15:11:20     By: merlea <merlea>
When calling squeeze on an array of structures with size [1,1,n] an internal
error (error: internal error: dimension mismatch across fields in struct) is
triggered which is unexpected.

octave:1> bfp0 = struct('a',1);
octave:2> bfp1 = cat(3,bfp0,bfp0);
octave:3> size(bfp1)
ans =

   1   1   2

octave:4> squeeze(bfp1)
error: internal error: dimension mismatch across fields in struct

This does not happen if instead the original array size if [m,1,n] or [1,m,n]
with m>1:

octave:7> bfp2 = cat(1,bfp1,bfp1);
octave:8> size(bfp2)
ans =

   2   1   2

octave:9> squeeze(bfp2)
ans =

  2x2 struct array containing the fields:

    a

octave:10> bfp2 = cat(2,bfp1,bfp1);
octave:11> size(bfp2)
ans =

   1   2   2

octave:12> squeeze(bfp2)
ans =

  2x2 struct array containing the fields:

    a



This behaviour is consistent across versions 8.4.0 to 11.3.0.







    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Message posté via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCajlQogAKCRCqLAuaBUf3
TpnuAP9tg6SJVomd6ujOEQTQlBQfEU0WELDGd/lvVEOCtqdOdwEAw+K5D2vQVdgt
p1iAARdtvsAvAh6W5Fh2qs85650aFgA=
=d2L9
-----END PGP SIGNATURE-----