changeset 12511:85e87b865f71

Change copy_backward to copy in Sparse<T>::assign, bug #32747 cf. changeset 3bddc4ea8141
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Mon, 14 Mar 2011 23:36:20 -0600
parents a1b2da4967ac
children 77b14e634166
files liboctave/ChangeLog liboctave/Sparse.cc
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Wed Mar 16 15:00:09 2011 -0700
+++ b/liboctave/ChangeLog	Mon Mar 14 23:36:20 2011 -0600
@@ -4,6 +4,12 @@
 	SM octinternal_do_mul_colpm_sm (const octave_idx_type *,
 	const SM&)): Ensure that the row indices are sorted.
 
+2011-03-14  Jordi GutiƩrrez Hermoso  <jordigh@gmail.com>
+
+	* Sparse.cc (Sparse<T>::alloc) Change std::copy_backward to
+	std::copy, since the destination is at the back and not the
+	front. Bug #32747, cf. entry from 2010-11-25
+
 2011-02-08  John W. Eaton  <jwe@octave.org>
 
 	* oct-alloc.h: Include <cstddef>.
--- a/liboctave/Sparse.cc	Wed Mar 16 15:00:09 2011 -0700
+++ b/liboctave/Sparse.cc	Mon Mar 14 23:36:20 2011 -0600
@@ -1928,8 +1928,10 @@
                   if (new_nz > nz)
                     {
                       // Make room first.
-                      std::copy_backward (data () + ui, data () + nz, data () + li + rnz);
-                      std::copy_backward (ridx () + ui, ridx () + nz, ridx () + li + rnz);
+                      std::copy (data () + ui, data () + nz,
+                                 data () + li + rnz);
+                      std::copy (ridx () + ui, ridx () + nz,
+                                 ridx () + li + rnz);
                       mx_inline_add2 (nc - ub, cidx () + ub + 1, new_nz - nz);
                     }