From 8a866b8296874b5f6f3371bb368c8191c828d98f Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 26 Oct 2017 20:09:24 +0000 Subject: [PATCH] Fix unsharing of GIMPLE_OMP_{SINGLE,TARGET,TEAMS} in gimple_copy 2017-10-26 Tom de Vries PR tree-optimization/82707 * gimple.c (gimple_copy): Fix unsharing of GIMPLE_OMP_{SINGLE,TARGET,TEAMS}. From-SVN: r254120 --- gcc/ChangeLog | 6 ++++++ gcc/gimple.c | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d5d32b9258e..791f3c169ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-26 Tom de Vries + + PR tree-optimization/82707 + * gimple.c (gimple_copy): Fix unsharing of + GIMPLE_OMP_{SINGLE,TARGET,TEAMS}. + 2017-10-26 Olga Makhotina * config/i386/avx512fintrin.h (_mm512_cmpeq_pd_mask, diff --git a/gcc/gimple.c b/gcc/gimple.c index 1f291e10286..37f2248f224 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1840,11 +1840,35 @@ gimple_copy (gimple *stmt) gimple_omp_sections_set_clauses (copy, t); t = unshare_expr (gimple_omp_sections_control (stmt)); gimple_omp_sections_set_control (copy, t); - /* FALLTHRU */ + goto copy_omp_body; case GIMPLE_OMP_SINGLE: + { + gomp_single *omp_single_copy = as_a (copy); + t = unshare_expr (gimple_omp_single_clauses (stmt)); + gimple_omp_single_set_clauses (omp_single_copy, t); + } + goto copy_omp_body; + case GIMPLE_OMP_TARGET: + { + gomp_target *omp_target_stmt = as_a (stmt); + gomp_target *omp_target_copy = as_a (copy); + t = unshare_expr (gimple_omp_target_clauses (omp_target_stmt)); + gimple_omp_target_set_clauses (omp_target_copy, t); + t = unshare_expr (gimple_omp_target_data_arg (omp_target_stmt)); + gimple_omp_target_set_data_arg (omp_target_copy, t); + } + goto copy_omp_body; + case GIMPLE_OMP_TEAMS: + { + gomp_teams *omp_teams_copy = as_a (copy); + t = unshare_expr (gimple_omp_teams_clauses (stmt)); + gimple_omp_teams_set_clauses (omp_teams_copy, t); + } + /* FALLTHRU */ + case GIMPLE_OMP_SECTION: case GIMPLE_OMP_MASTER: case GIMPLE_OMP_TASKGROUP: -- 2.30.2