http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59659
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |compile-time-hog, | |memory-hog, | |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2014-01-07 Summary|large zero-initialized |large zero-initialized |std::array of std::atomic |std::array compile time |compile time excessive |excessive Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The frontend generates struct array arr; struct array arr; <<cleanup_point <<< Unknown tree: expr_stmt <<cleanup_point <<< Unknown tree: expr_stmt arr._M_elems[0] = TARGET_EXPR <D.25804, {.D.23130={._M_i=0}}> >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt arr._M_elems[1] = TARGET_EXPR <D.25805, {.D.23130={._M_i=0}}> >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt arr._M_elems[2] = TARGET_EXPR <D.25806, {.D.23130={._M_i=0}}> >>>>>; <<cleanup_point <<< Unknown tree: expr_stmt arr._M_elems[3] = TARGET_EXPR <D.25807, {.D.23130={._M_i=0}}> >>>>>; ... instead of generating a loop. Which may be the cause of std::atomic having some subtle property (thus reproducible with a random class with that very same property eventually). Same issue with the following, so it's std::array's fault (or rather initializer list support). #include <array> class Foo { public: Foo() {} int i; }; int main() { std::array<Foo, 1000000> arr = {{}}; // Halting problem. }