aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-21 23:33:52 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-21 23:33:52 +0100
commit44f4e4182bb7954a117781e7f4f658af69dec3fd (patch)
tree5bcf9aac2ab5fb87ec37838b8be6f37402aca0c7 /gcc/cp/optimize.c
parent2f86f1f80d6e2ff1e26c3b637a4db534572ecf5c (diff)
downloadgcc-44f4e4182bb7954a117781e7f4f658af69dec3fd.zip
gcc-44f4e4182bb7954a117781e7f4f658af69dec3fd.tar.gz
gcc-44f4e4182bb7954a117781e7f4f658af69dec3fd.tar.bz2
re PR c++/88949 (ICE in expand_expr_real_1, at expr.c:10001 with -fopenmp)
PR c++/88949 * optimize.c (cxx_copy_decl): New function. (clone_body): Use it instead of copy_decl_no_change. * g++.dg/gomp/pr88949.C: New test. From-SVN: r268127
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 40d0dcc..7b6edfc 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -61,6 +61,25 @@ update_cloned_parm (tree parm, tree cloned_parm, bool first)
DECL_GIMPLE_REG_P (cloned_parm) = DECL_GIMPLE_REG_P (parm);
}
+/* Like copy_decl_no_change, but handle DECL_OMP_PRIVATIZED_MEMBER
+ properly. */
+
+static tree
+cxx_copy_decl (tree decl, copy_body_data *id)
+{
+ tree copy = copy_decl_no_change (decl, id);
+ if (VAR_P (decl)
+ && DECL_HAS_VALUE_EXPR_P (decl)
+ && DECL_ARTIFICIAL (decl)
+ && DECL_LANG_SPECIFIC (decl)
+ && DECL_OMP_PRIVATIZED_MEMBER (decl))
+ {
+ tree expr = DECL_VALUE_EXPR (copy);
+ walk_tree (&expr, copy_tree_body_r, id, NULL);
+ SET_DECL_VALUE_EXPR (copy, expr);
+ }
+ return copy;
+}
/* FN is a function in High GIMPLE form that has a complete body and no
CFG. CLONE is a function whose body is to be set to a copy of FN,
@@ -80,7 +99,7 @@ clone_body (tree clone, tree fn, void *arg_map)
id.src_cfun = DECL_STRUCT_FUNCTION (fn);
id.decl_map = static_cast<hash_map<tree, tree> *> (arg_map);
- id.copy_decl = copy_decl_no_change;
+ id.copy_decl = cxx_copy_decl;
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = true;
id.transform_return_to_modify = false;