Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#2195 closed Bugs (fixed)

[uBlas] compressed_matrix::erase_element() segfaults

Reported by: Niko Vuokko <niko.vuokko@…> Owned by: Gunter
Milestone: Boost 1.41.0 Component: uBLAS
Version: Boost Development Trunk Severity: Problem
Keywords: compressed_matrix erase_element Cc:

Description

The following example segfaults, system is GCC 3.4.4 on Cygwin, Boost 1.35.0.

compressed_matrix<int> m(2,2);
m(0,0) = 1;
m.erase_element(1,0);

The problem is that inside erase_element std::lower_bound oddly returns it_begin, even though simple

while(*itt < elem2)
   ++itt;

returns it_begin+2.

Attachments (1)

comp_mat_erase.cpp (239 bytes ) - added by Gunter 13 years ago.
example to provoke segfault

Download all attachments as: .zip

Change History (7)

comment:1 by (none), 14 years ago

Milestone: Boost 1.35.1

Milestone Boost 1.35.1 deleted

comment:2 by Gunter, 13 years ago

Milestone: Boost 1.40.0
Status: newassigned
Version: Boost 1.35.0Boost Development Trunk

bug still exists with gcc version 4.3.2 (Debian 4.3.2-1.1)

by Gunter, 13 years ago

Attachment: comp_mat_erase.cpp added

example to provoke segfault

comment:3 by Gunter, 13 years ago

(In [54230]) comp_mat_erase.cpp - unit test to verify compressed matrix layout, insertion and erasure of elements, see #2195

CMakeLists.txt - added new test: comp_mat_erase

Jamfile.v2 - added new test: comp_mat_erase

comment:4 by Gunter, 13 years ago

(In [54231]) matrix_sparse.hpp - see #2195, fixed compressed_matrix::erase_element(); must use >= instead of > because the last element of index1_data is the "end of list" marker. Segfault was caused by *(itv + 1) which pointed to an element _after_ index1_data.end()

comment:5 by Gunter, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [56605]) fix #2195:

  • merged changes into release branch

comment:6 by Gunter, 13 years ago

Milestone: Boost 1.40.0Boost 1.41.0

merged into 1.41.0

Note: See TracTickets for help on using tickets.