aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-05-03 10:38:04 +0200
committerJakub Jelinek <jakub@redhat.com>2023-05-03 10:38:04 +0200
commit8d193b12d6f07ae0196db8296a49c881c1638c01 (patch)
tree5ef47a9339e0b21510c8e3f31d6a64c578a87401 /gcc
parent0bc2a1dc327af9817163cc8df78b9f9be2ad0f90 (diff)
downloadgcc-8d193b12d6f07ae0196db8296a49c881c1638c01.zip
gcc-8d193b12d6f07ae0196db8296a49c881c1638c01.tar.gz
gcc-8d193b12d6f07ae0196db8296a49c881c1638c01.tar.bz2
c++: Fix up VEC_INIT_EXPR gimplification after r12-7069
During patch backporting, I've noticed that while most cp_walk_tree calls with cp_fold_r callback callers were changed from &pset to cp_fold_data &data, the VEC_INIT_EXPR gimplifications has not, so it still passes just address of a hash_set<tree> and so if during the folding we ever touch data->flags, we use uninitialized data there. The following patch changes it to do the same thing as cp_fold_function because the VEC_INIT_EXPR gimplifications will happen on function bodies only. 2023-05-03 Jakub Jelinek <jakub@redhat.com> * cp-gimplify.cc (cp_fold_data): Move definition earlier. (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false constructed data rather than &pset to cp_walk_tree with cp_fold_r.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/cp-gimplify.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 4fecd56..1216ef1 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -57,6 +57,13 @@ enum fold_flags {
using fold_flags_t = int;
+struct cp_fold_data
+{
+ hash_set<tree> pset;
+ fold_flags_t flags;
+ cp_fold_data (fold_flags_t flags): flags (flags) {}
+};
+
/* Forward declarations. */
static tree cp_genericize_r (tree *, int *, void *);
@@ -505,8 +512,8 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
*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_fold_data data (ff_genericize | ff_mce_false);
+ cp_walk_tree (expr_p, cp_fold_r, &data, NULL);
cp_genericize_tree (expr_p, false);
copy_if_shared (expr_p);
ret = GS_OK;
@@ -1029,13 +1036,6 @@ struct cp_genericize_data
in fold-const, we need to perform this before transformation to
GIMPLE-form. */
-struct cp_fold_data
-{
- hash_set<tree> pset;
- fold_flags_t flags;
- cp_fold_data (fold_flags_t flags): flags (flags) {}
-};
-
static tree
cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
{