public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59659] New: large zero-initialized std::array of std::atomic compile time excessive
@ 2014-01-02 15:25 devaneymark at gmail dot com
  2014-01-02 16:04 ` [Bug c++/59659] " Casey at Carter dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: devaneymark at gmail dot com @ 2014-01-02 15:25 UTC (permalink / raw)
  To: gcc-bugs

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;
}


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-24 17:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-02 15:25 [Bug c++/59659] New: large zero-initialized std::array of std::atomic compile time excessive devaneymark at gmail dot com
2014-01-02 16:04 ` [Bug c++/59659] " Casey at Carter dot net
2014-01-07 11:48 ` [Bug c++/59659] large zero-initialized std::array " rguenth at gcc dot gnu.org
2014-01-09 16:18 ` jakub at gcc dot gnu.org
2014-01-09 16:25 ` jakub at gcc dot gnu.org
2014-01-09 16:59 ` trippels at gcc dot gnu.org
2014-01-09 17:03 ` jakub at gcc dot gnu.org
2014-01-09 17:24 ` trippels at gcc dot gnu.org
2014-01-10 17:16 ` jason at gcc dot gnu.org
2014-01-24 16:48 ` jason at gcc dot gnu.org
2014-01-24 17:09 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).