This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/59659] New: large zero-initialized std::array of std::atomic compile time excessive
- From: "devaneymark at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Jan 2014 15:25:35 +0000
- Subject: [Bug c++/59659] New: large zero-initialized std::array of std::atomic compile time excessive
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59659
Bug ID: 59659
Summary: large zero-initialized std::array of std::atomic
compile time excessive
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: devaneymark at gmail dot com
Compiling the below with any of the zero-initialization forms of std::atomic
takes at least several hours (3GhZ Intel). The default-initialized and
non-atomic forms compile immediately.
g++ --std=c++11 -O0 : no other compile flags
reproducible under 4.8.2 and 4.7.2
#include <iostream>
#include <array>
#include <algorithm>
#include <atomic>
int main(int argc, char* argv[]) {
// std::array<std::atomic<int>, 1000000> arr; // default
initialization (i.e., random data) = FAST
std::array<std::atomic<int>, 1000000> arr{{}}; // zero initialization =
FOREVER
//std::array<std::atomic<int>, 1000000> arr{}; // zero initialization =
FOREVER
//std::array<std::atomic<int>, 1000000> arr={{}}; // zero init via
assignment = FOREVER
//std::array<int, 1000000> arr={{}}; // zero init non-atomic = FAST
std::cerr << "sum = " << std::accumulate(arr.begin(), arr.end(), 0) <<
std::endl;
}