Opened 10 years ago

Last modified 10 years ago

#7507 new Bugs

BGL subgraph copy constructor buggy

Reported by: Amyn Bennamane <amynbe@…> Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.51.0 Severity: Problem
Keywords: copy-on-write, subgraph copy constructor Cc:

Description

Hello,

I store subgraph objects in a std::list.

After this, most of the data contained in subgraphs are lost.

Attached is a minimalist code that creates a root graph and two childen, and then displays them directly, then insert them into a (copy-on-write) list, then displays them again.

The root redisplays too much, and children lose data.

I am on MacOSX with gcc 6; maybe on other platforms the copy would not happen, since I don't modify the graphs between insertion and display.

Here is my output:

From the stack: 
(root) graph: 6(0,2) 4(1,2) 
num_edges= 2
subgraph: 0(0,1) 
num_edges= 1
subgraph: 0(0,1) 
num_edges= 1

From list: 
graph: 0(0,1) 1(1,2) 2(1,3) 6(2,5) 3(4,1) 4(4,5) 5(5,3) 
num_edges= 7
graph: 
num_edges= 0
graph: 
num_edges= 0

Attachments (1)

bglcowtest.cpp (2.8 KB ) - added by Amyn Bennamane <amynbe@…> 10 years ago.
BGL subgraph copy constructor bug sample

Download all attachments as: .zip

Change History (2)

by Amyn Bennamane <amynbe@…>, 10 years ago

Attachment: bglcowtest.cpp added

BGL subgraph copy constructor bug sample

comment:1 by Amyn Bennamane <amynbe@…>, 10 years ago

I am using gcc 4.2.1, not 6

Note: See TracTickets for help on using tickets.