Opened 9 years ago

Closed 9 years ago

#9930 closed Bugs (invalid)

Copy-constructed mt19937_64 segfaults

Reported by: Tim Cooijmans <t.cooijmans@…> Owned by: No-Maintainer
Milestone: To Be Determined Component: random
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

The copy constructor for mt19937_64 seems to leave the copy in a corrupt state. Trying to generate random numbers from the copy consistently results in a segmentation fault.

The attached file exhibits the problem:

$ g++ -std=c++11 -g -O0 main.cpp && ./a.out 5 5 $ g++ -std=c++11 -g -O0 -DUSE_64BIT main.cpp && ./a.out 1 Segmentation fault (core dumped)

The version of g++ used is "g++-4.8 (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1".

Attachments (1)

main.cpp (913 bytes ) - added by Tim Cooijmans <t.cooijmans@…> 9 years ago.

Download all attachments as: .zip

Change History (3)

by Tim Cooijmans <t.cooijmans@…>, 9 years ago

Attachment: main.cpp added

comment:1 by Tim Cooijmans <t.cooijmans@…>, 9 years ago

Okay, I should have previewed. This is the terminal session with proper formatting:

$ g++ -std=c++11 -g -O0 main.cpp && ./a.out
5
5
$ g++ -std=c++11 -g -O0 -DUSE_64BIT main.cpp && ./a.out
1
Segmentation fault (core dumped)

comment:2 by Steven Watanabe, 9 years ago

Resolution: invalid
Status: newclosed

return_generator returns a dangling reference to the local generator.

Note: See TracTickets for help on using tickets.