aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Harwath <frederik@codesourcery.com>2020-04-21 12:36:14 +0200
committerFrederik Harwath <frederik@codesourcery.com>2020-04-21 15:12:05 +0200
commit15256c8a8ac6573d250506c40dbe13082186c2aa (patch)
tree08bb1a7a75b85246792c18c03475348c29f9bc40
parentac1a0a388cd9529b4ba8b10d8ccd8099a2a95b23 (diff)
downloadgcc-15256c8a8ac6573d250506c40dbe13082186c2aa.zip
gcc-15256c8a8ac6573d250506c40dbe13082186c2aa.tar.gz
gcc-15256c8a8ac6573d250506c40dbe13082186c2aa.tar.bz2
Remove fishy self-assignment in omp-low.c [PR94629]
The PR noticed that omp-low.c contains a self-assignment in the function new_omp_context: if (outer_ctx) { ... ctx->outer_reduction_clauses = ctx->outer_reduction_clauses; This is obviously useless. The original intention might have been to copy the field from the outer_ctx to ctx. Since this is done (properly) in the only function where this field is actually used (in function scan_omp_for) and the field is being initialized to zero during the struct allocation, there is no need to attempt to do anything to this field in new_omp_context. Thus this commit removes any assignment to the field from new_omp_context. 2020-04-21 Frederik Harwath <frederik@codesourcery.com> PR other/94629 * gcc/omp-low.c (new_omp_context): Remove assignments to ctx->outer_reduction_clauses and ctx->local_reduction_clauses. Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/omp-low.c14
2 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 721928d..c3572ca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-21 Frederik Harwath <frederik@codesourcery.com>
+
+ PR other/94629
+ * omp-low.c (new_omp_context): Remove assignments to
+ ctx->outer_reduction_clauses and ctx->local_reduction_clauses.
+
2020-04-20 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/vector.md ("popcountv8hi2_vx", "popcountv4si2_vx")
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 67565d6..88f23e6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -128,10 +128,16 @@ struct omp_context
corresponding tracking loop iteration variables. */
hash_map<tree, tree> *lastprivate_conditional_map;
- /* A tree_list of the reduction clauses in this context. */
+ /* A tree_list of the reduction clauses in this context. This is
+ only used for checking the consistency of OpenACC reduction
+ clauses in scan_omp_for and is not guaranteed to contain a valid
+ value outside of this function. */
tree local_reduction_clauses;
- /* A tree_list of the reduction clauses in outer contexts. */
+ /* A tree_list of the reduction clauses in outer contexts. This is
+ only used for checking the consistency of OpenACC reduction
+ clauses in scan_omp_for and is not guaranteed to contain a valid
+ value outside of this function. */
tree outer_reduction_clauses;
/* Nesting depth of this context. Used to beautify error messages re
@@ -931,8 +937,6 @@ new_omp_context (gimple *stmt, omp_context *outer_ctx)
ctx->outer = outer_ctx;
ctx->cb = outer_ctx->cb;
ctx->cb.block = NULL;
- ctx->local_reduction_clauses = NULL;
- ctx->outer_reduction_clauses = ctx->outer_reduction_clauses;
ctx->depth = outer_ctx->depth + 1;
}
else
@@ -948,8 +952,6 @@ new_omp_context (gimple *stmt, omp_context *outer_ctx)
ctx->cb.transform_call_graph_edges = CB_CGE_MOVE;
ctx->cb.adjust_array_error_bounds = true;
ctx->cb.dont_remap_vla_if_no_change = true;
- ctx->local_reduction_clauses = NULL;
- ctx->outer_reduction_clauses = NULL;
ctx->depth = 1;
}