http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59659

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> For the #c0 testcase, I think reduced testcase is:
> struct S { S (); S (int); ~S (); int i; };
> struct A { S s[1000000]; };

That's a more general case of the problem, but atomic has constant
zero-initialization, which ought to simplify things.  This patch causes the
initialization to properly (and more quickly) become a memset:

diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index d9c3647..04f0bf7 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1182,6 +1182,7 @@ process_init_constructor_array (tree type, tree init,
              initialization explicit by list-initializing from {}.  */
            next = build_constructor (init_list_type_node, NULL);
            next = digest_init (TREE_TYPE (type), next, complain);
+           next = maybe_constant_init (next);
          }
        else if (!zero_init_p (TREE_TYPE (type)))
          next = build_zero_init (TREE_TYPE (type),

I'll poke at this some more.

Reply via email to