diff options
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1b161d5..622d6e9 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -4222,6 +4222,14 @@ build_vec_init (tree base, tree maxindex, tree init, else ptype = atype; + if (integer_all_onesp (maxindex)) + { + /* Shortcut zero element case to avoid unneeded constructor synthesis. */ + if (init && TREE_SIDE_EFFECTS (init)) + base = build2 (COMPOUND_EXPR, void_type_node, init, base); + return base; + } + /* The code we are generating looks like: ({ T* t1 = (T*) base; |