public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6339] c++: temporarily restore VEC_INIT_EXPR gimplify [PR103936]
@ 2022-01-07  5:23 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-01-07  5:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:765693be1c8dc91fe612e7a499c5e41ba398ab96

commit r12-6339-g765693be1c8dc91fe612e7a499c5e41ba398ab96
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 6 21:58:01 2022 -0500

    c++: temporarily restore VEC_INIT_EXPR gimplify [PR103936]
    
    PR103936 demonstrates that some VEC_INIT_EXPR can still survive into
    GENERIC; until that's fixed let's put back the handling in cp_gimplify_expr.
    
            PR c++/103936
            PR c++/65591
    
    gcc/cp/ChangeLog:
    
            * cp-gimplify.c (cp_gimplify_expr): Restore VEC_INIT_EXPR handling.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/init/aggr15.C: New test.

Diff:
---
 gcc/cp/cp-gimplify.c               | 13 +++++++++++++
 gcc/testsuite/g++.dg/init/aggr15.C | 11 +++++++++++
 2 files changed, 24 insertions(+)

diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 114fa78b353..8b097c46158 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -469,6 +469,19 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
       ret = GS_OK;
       break;
 
+    case VEC_INIT_EXPR:
+      {
+	*expr_p = expand_vec_init_expr (NULL_TREE, *expr_p,
+					tf_warning_or_error);
+
+	hash_set<tree> pset;
+	cp_walk_tree (expr_p, cp_fold_r, &pset, NULL);
+	cp_genericize_tree (expr_p, false);
+	copy_if_shared (expr_p);
+	ret = GS_OK;
+      }
+      break;
+
     case THROW_EXPR:
       /* FIXME communicate throw type to back end, probably by moving
 	 THROW_EXPR into ../tree.def.  */
diff --git a/gcc/testsuite/g++.dg/init/aggr15.C b/gcc/testsuite/g++.dg/init/aggr15.C
new file mode 100644
index 00000000000..a19a0f8e47b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/aggr15.C
@@ -0,0 +1,11 @@
+// PR c++/65591
+
+struct ss {
+    ss() {};
+};
+struct C {
+      ss s[1000];
+};
+int main() {
+      C cs[5] = {};
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-07  5:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07  5:23 [gcc r12-6339] c++: temporarily restore VEC_INIT_EXPR gimplify [PR103936] Jason Merrill

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).