# HG changeset patch # User Rik # Date 1682042366 25200 # Node ID 39700c1ea93ef110a2d3e4fef2a2bdc3f501b79f # Parent 31f7f5359ba288eb0c2e243fe89cb5f353adf42a# Parent f18da620ab4dabd0dcc6ce7a687a2659a5e15829 maint: merge stable to default diff -r 31f7f5359ba2 -r 39700c1ea93e libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Thu Apr 20 16:49:31 2023 -0400 +++ b/libinterp/corefcn/data.cc Thu Apr 20 18:59:26 2023 -0700 @@ -5999,6 +5999,8 @@ %!assert (size (reshape (ones (15, 4, "single"), 1, 60)), [1, 60]) %!assert (size (reshape (ones (15, 4, "single"), 60, 1)), [60, 1]) +%!assert <*64080> (size (reshape (sparse (0, 1), 0, 0)), [0, 0]) + %!test %! s.a = 1; %! fail ("reshape (s, 2, 3)", "can't reshape 1x1 array to 2x3 array"); diff -r 31f7f5359ba2 -r 39700c1ea93e liboctave/array/Sparse.cc --- a/liboctave/array/Sparse.cc Thu Apr 20 16:49:31 2023 -0400 +++ b/liboctave/array/Sparse.cc Thu Apr 20 18:59:26 2023 -0700 @@ -873,6 +873,9 @@ octave_idx_type old_nr = rows (); octave_idx_type old_nc = cols (); retval = Sparse (new_nr, new_nc, new_nnz); + // Special case for empty matrices (bug #64080) + if (new_nr == 0 || new_nc == 0) + return retval; octave_idx_type kk = 0; retval.xcidx (0) = 0;