[gcc/devel/omp/gcc-14] Various OpenACC reduction enhancements - FE changes
Paul-Antoine Arras
parras@gcc.gnu.org
Fri Jun 28 09:46:57 GMT 2024
https://gcc.gnu.org/g:bae1b81b71b158901d0342b471450a3938ef2828
commit bae1b81b71b158901d0342b471450a3938ef2828
Author: Julian Brown <julian@codesourcery.com>
Date: Tue Feb 12 14:56:12 2019 -0800
Various OpenACC reduction enhancements - FE changes
This version differs somewhat from the last version posted upstream
(and addresses some of Jakub's review comments).
2018-12-13 Cesar Philippidis <cesar@codesourcery.com>
Nathan Sidwell <nathan@acm.org>
Julian Brown <julian@codesourcery.com>
gcc/c/
* c-parser.cc (c_parser_omp_variable_list): New c_omp_region_type
argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for
OpenACC.
(c_parser_oacc_data_clause): Add region-type argument.
(c_parser_oacc_data_clause_deviceptr): Likewise.
(c_parser_omp_clause_reduction): Change is_omp boolean parameter to
c_omp_region_type. Update call to c_parser_omp_variable_list.
(c_parser_oacc_all_clauses): Update calls to
c_parser_omp_clause_reduction.
(c_parser_omp_all_clauses): Likewise.
(c_parser_oacc_cache): Update call to c_parser_omp_var_list_parens.
* c-typeck.cc (c_finish_omp_clauses): Emit an error on orphan OpenACC
gang reductions. Suppress user-defined reduction error for OpenACC.
gcc/cp/
* parser.cc (cp_parser_omp_var_list_no_open): New c_omp_region_type
argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for
OpenACC.
(cp_parser_omp_var_list): Add c_omp_region_type argument. Update call
to cp_parser_omp_var_list_parens.
(cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list.
(cp_parser_omp_clause_reduction): Change is_omp boolean parameter to
c_omp_region_type. Update call to cp_parser_omp_var_list_no_open.
(cp_parser_oacc_all_clauses): Update call to
cp_parser_omp_clause_reduction.
(cp_parser_omp_all_clauses): Likewise.
* semantics.cc (finish_omp_reduction_clause): Add c_omp_region_type
argument. Suppress user-defined reduction error for OpenACC.
(finish_omp_clauses): Emit an error on orphan OpenACC gang reductions.
gcc/fortran/
* openmp.cc (oacc_is_parallel): New.
(resolve_oacc_loop_blocks): Emit an error on orphan OpenACC
gang reductions.
* trans-openmp.cc (gfc_omp_clause_copy_ctor): Permit reductions.
2022-02-03 Kwok Cheung Yeung <kcy@codesourcery.com>
gcc/c/
* c-parser.cc (c_parser_omp_clause_map): Update call to
c_parser_omp_variable_list.
(c_parser_omp_clause_to): Update call to c_parser_omp_var_list_parens.
(c_parser_omp_clause_from): Likewise.
gcc/cp/
* parser.cc (cp_parser_omp_clause_map): Update call to
cp_parser_omp_var_list_no_open.
(cp_parser_omp_all_clauses): Update calls to cp_parser_omp_var_list.
Diff:
---
gcc/c/ChangeLog.omp | 25 +++++++++++++++++++++++++
gcc/c/c-parser.cc | 41 ++++++++++++++++++++++++-----------------
gcc/c/c-typeck.cc | 7 +++++--
gcc/cp/ChangeLog.omp | 25 +++++++++++++++++++++++++
gcc/cp/parser.cc | 29 ++++++++++++++++-------------
gcc/cp/semantics.cc | 15 +++++++++------
gcc/fortran/ChangeLog.omp | 9 +++++++++
gcc/fortran/trans-openmp.cc | 3 ++-
8 files changed, 115 insertions(+), 39 deletions(-)
diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp
index 76ed3228d5d..a95b2adc8f8 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,28 @@
+2022-02-03 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * c-parser.ccc (c_parser_omp_clause_map): Update call to
+ c_parser_omp_variable_list.
+ (c_parser_omp_clause_to): Update call to c_parser_omp_var_list_parens.
+ (c_parser_omp_clause_from): Likewise.
+
+2018-12-13 Cesar Philippidis <cesar@codesourcery.com>
+ Nathan Sidwell <nathan@acm.org>
+ Julian Brown <julian@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_variable_list): New c_omp_region_type
+ argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for
+ OpenACC.
+ (c_parser_oacc_data_clause): Add region-type argument.
+ (c_parser_oacc_data_clause_deviceptr): Likewise.
+ (c_parser_omp_clause_reduction): Change is_omp boolean parameter to
+ c_omp_region_type. Update call to c_parser_omp_variable_list.
+ (c_parser_oacc_all_clauses): Update calls to
+ c_parser_omp_clause_reduction.
+ (c_parser_omp_all_clauses): Likewise.
+ (c_parser_oacc_cache): Update call to c_parser_omp_var_list_parens.
+ * c-typeck.c (c_finish_omp_clauses): Emit an error on orphan OpenACC
+ gang reductions. Suppress user-defined reduction error for OpenACC.
+
2020-04-19 Chung-Lin Tang <cltang@codesourcery.com>
PR other/76739
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 00f8bf4376e..fdbcbb73819 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -15159,7 +15159,7 @@ c_parser_oacc_wait_list (c_parser *parser, location_t clause_loc, tree list)
If KIND is zero, create a TREE_LIST with the decl in TREE_PURPOSE;
return the list created.
- The optional ALLOW_DEREF argument is true if list items can use the deref
+ The optional MAP_LVALUE argument is true if list items can use the deref
(->) operator. */
struct omp_dim
@@ -15175,6 +15175,7 @@ static tree
c_parser_omp_variable_list (c_parser *parser,
location_t clause_loc,
enum omp_clause_code kind, tree list,
+ enum c_omp_region_type ort = C_ORT_OMP,
bool map_lvalue = false)
{
auto_vec<omp_dim> dims;
@@ -15449,7 +15450,8 @@ c_parser_omp_variable_list (c_parser *parser,
case OMP_CLAUSE_HAS_DEVICE_ADDR:
array_section_p = false;
dims.truncate (0);
- while (c_parser_next_token_is (parser, CPP_OPEN_SQUARE))
+ while ((ort != C_ORT_ACC || kind != OMP_CLAUSE_REDUCTION)
+ && c_parser_next_token_is (parser, CPP_OPEN_SQUARE))
{
location_t loc = UNKNOWN_LOCATION;
tree low_bound = NULL_TREE, length = NULL_TREE;
@@ -15584,12 +15586,14 @@ c_parser_omp_variable_list (c_parser *parser,
}
/* Similarly, but expect leading and trailing parenthesis. This is a very
- common case for OpenACC and OpenMP clauses. The optional ALLOW_DEREF
+ common case for OpenACC and OpenMP clauses. The optional MAP_LVALUE
argument is true if list items can use the deref (->) operator. */
static tree
c_parser_omp_var_list_parens (c_parser *parser, enum omp_clause_code kind,
- tree list, bool map_lvalue = false)
+ tree list,
+ enum c_omp_region_type ort = C_ORT_OMP,
+ bool map_lvalue = false)
{
/* The clauses location. */
location_t loc = c_parser_peek_token (parser)->location;
@@ -15610,7 +15614,8 @@ c_parser_omp_var_list_parens (c_parser *parser, enum omp_clause_code kind,
matching_parens parens;
if (parens.require_open (parser))
{
- list = c_parser_omp_variable_list (parser, loc, kind, list, map_lvalue);
+ list = c_parser_omp_variable_list (parser, loc, kind, list, ort,
+ map_lvalue);
parens.skip_until_found_close (parser);
}
return list;
@@ -15705,7 +15710,7 @@ c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
}
}
nl = c_parser_omp_variable_list (parser, open_loc, OMP_CLAUSE_MAP, list,
- false);
+ C_ORT_ACC, false);
parens.skip_until_found_close (parser);
}
@@ -15731,7 +15736,8 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
/* Can't use OMP_CLAUSE_MAP here (that is, can't use the generic
c_parser_oacc_data_clause), as for PRAGMA_OACC_CLAUSE_DEVICEPTR,
variable-list must only allow for pointer variables. */
- vars = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ERROR, NULL);
+ vars = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ERROR, NULL,
+ C_ORT_ACC);
for (t = vars; t && t; t = TREE_CHAIN (t))
{
tree v = TREE_PURPOSE (t);
@@ -17295,7 +17301,7 @@ c_parser_omp_clause_private (c_parser *parser, tree list)
static tree
c_parser_omp_clause_reduction (c_parser *parser, enum omp_clause_code kind,
- bool is_omp, tree list)
+ enum c_omp_region_type ort, tree list)
{
location_t clause_loc = c_parser_peek_token (parser)->location;
matching_parens parens;
@@ -17306,7 +17312,7 @@ c_parser_omp_clause_reduction (c_parser *parser, enum omp_clause_code kind,
enum tree_code code = ERROR_MARK;
tree reduc_id = NULL_TREE;
- if (kind == OMP_CLAUSE_REDUCTION && is_omp)
+ if (kind == OMP_CLAUSE_REDUCTION && ort == C_ORT_OMP)
{
if (c_parser_next_token_is_keyword (parser, RID_DEFAULT)
&& c_parser_peek_2nd_token (parser)->type == CPP_COMMA)
@@ -17387,7 +17393,8 @@ c_parser_omp_clause_reduction (c_parser *parser, enum omp_clause_code kind,
{
tree nl, c;
- nl = c_parser_omp_variable_list (parser, clause_loc, kind, list);
+ nl = c_parser_omp_variable_list (parser, clause_loc, kind, list, ort);
+
for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
{
tree d = OMP_CLAUSE_DECL (c), type;
@@ -18894,7 +18901,7 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
}
nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_MAP, list,
- true);
+ C_ORT_OMP, true);
for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
OMP_CLAUSE_SET_MAP_KIND (c, kind);
@@ -19161,7 +19168,7 @@ c_parser_omp_clause_from_to (c_parser *parser, enum omp_clause_code kind,
c_parser_consume_token (parser);
}
- tree nl = c_parser_omp_variable_list (parser, loc, kind, list);
+ tree nl = c_parser_omp_variable_list (parser, loc, kind, list, C_ORT_OMP);
parens.skip_until_found_close (parser);
if (present)
@@ -19391,7 +19398,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
case PRAGMA_OACC_CLAUSE_REDUCTION:
clauses
= c_parser_omp_clause_reduction (parser, OMP_CLAUSE_REDUCTION,
- false, clauses);
+ C_ORT_ACC, clauses);
c_name = "reduction";
break;
case PRAGMA_OACC_CLAUSE_SELF:
@@ -19557,7 +19564,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
case PRAGMA_OMP_CLAUSE_IN_REDUCTION:
clauses
= c_parser_omp_clause_reduction (parser, OMP_CLAUSE_IN_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "in_reduction";
break;
case PRAGMA_OMP_CLAUSE_INDIRECT:
@@ -19603,7 +19610,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
case PRAGMA_OMP_CLAUSE_REDUCTION:
clauses
= c_parser_omp_clause_reduction (parser, OMP_CLAUSE_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "reduction";
break;
case PRAGMA_OMP_CLAUSE_SCHEDULE:
@@ -19617,7 +19624,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
case PRAGMA_OMP_CLAUSE_TASK_REDUCTION:
clauses
= c_parser_omp_clause_reduction (parser, OMP_CLAUSE_TASK_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "task_reduction";
break;
case PRAGMA_OMP_CLAUSE_UNTIED:
@@ -19876,7 +19883,7 @@ c_parser_oacc_cache (location_t loc, c_parser *parser)
readonly = true;
}
clauses = c_parser_omp_variable_list (parser, open_loc,
- OMP_CLAUSE__CACHE_, NULL_TREE);
+ OMP_CLAUSE__CACHE_, NULL_TREE, C_ORT_ACC);
parens.skip_until_found_close (parser);
}
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 1db626f7cae..7f466b858d9 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -14968,8 +14968,11 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
}
else if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) == error_mark_node)
{
- error_at (OMP_CLAUSE_LOCATION (c),
- "user defined reduction not found for %qE", t);
+ /* There are no user-defined reductions in OpenACC (as of
+ 2.6). */
+ if (ort & C_ORT_OMP)
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "user defined reduction not found for %qE", t);
remove = true;
break;
}
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 624388c45cc..a87d118e4bb 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,28 @@
+2022-02-03 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * parser.ccc (cp_parser_omp_clause_map): Update call to
+ cp_parser_omp_var_list_no_open.
+ (cp_parser_omp_all_clauses): Update calls to cp_parser_omp_var_list.
+
+2018-12-13 Cesar Philippidis <cesar@codesourcery.com>
+ Nathan Sidwell <nathan@acm.org>
+ Julian Brown <julian@codesourcery.com>
+
+ * parser.c (cp_parser_omp_var_list_no_open): New c_omp_region_type
+ argument. Use it to specialize handling of OMP_CLAUSE_REDUCTION for
+ OpenACC.
+ (cp_parser_omp_var_list): Add c_omp_region_type argument. Update call
+ to cp_parser_omp_var_list_parens.
+ (cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list.
+ (cp_parser_omp_clause_reduction): Change is_omp boolean parameter to
+ c_omp_region_type. Update call to cp_parser_omp_var_list_no_open.
+ (cp_parser_oacc_all_clauses): Update call to
+ cp_parser_omp_clause_reduction.
+ (cp_parser_omp_all_clauses): Likewise.
+ * semantics.c (finish_omp_reduction_clause): Add c_omp_region_type
+ argument. Suppress user-defined reduction error for OpenACC.
+ (finish_omp_clauses): Emit an error on orphan OpenACC gang reductions.
+
2020-04-19 Chung-Lin Tang <cltang@codesourcery.com>
PR other/76739
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 598380dda08..ba3c4dd9ef1 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -38147,6 +38147,7 @@ struct omp_dim
static tree
cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
tree list, bool *colon,
+ enum c_omp_region_type ort = C_ORT_OMP,
bool map_lvalue = false)
{
auto_vec<omp_dim> dims;
@@ -38363,7 +38364,8 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
case OMP_CLAUSE_HAS_DEVICE_ADDR:
array_section_p = false;
dims.truncate (0);
- while (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
+ while ((ort != C_ORT_ACC || kind != OMP_CLAUSE_REDUCTION)
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
{
location_t loc = UNKNOWN_LOCATION;
tree low_bound = NULL_TREE, length = NULL_TREE;
@@ -38511,6 +38513,7 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
static tree
cp_parser_omp_var_list (cp_parser *parser, enum omp_clause_code kind, tree list,
+ enum c_omp_region_type ort = C_ORT_OMP,
bool map_lvalue = false)
{
if (parser->lexer->in_omp_decl_attribute)
@@ -38529,7 +38532,7 @@ cp_parser_omp_var_list (cp_parser *parser, enum omp_clause_code kind, tree list,
}
if (cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
- return cp_parser_omp_var_list_no_open (parser, kind, list, NULL,
+ return cp_parser_omp_var_list_no_open (parser, kind, list, NULL, ort,
map_lvalue);
return list;
}
@@ -38621,7 +38624,7 @@ cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
}
}
nl = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_MAP, list, NULL,
- false);
+ C_ORT_ACC, false);
}
for (tree c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
@@ -39976,7 +39979,7 @@ cp_parser_omp_clause_ordered (cp_parser *parser,
static tree
cp_parser_omp_clause_reduction (cp_parser *parser, enum omp_clause_code kind,
- bool is_omp, tree list)
+ enum c_omp_region_type ort, tree list)
{
enum tree_code code = ERROR_MARK;
tree nlist, c, id = NULL_TREE;
@@ -39986,7 +39989,7 @@ cp_parser_omp_clause_reduction (cp_parser *parser, enum omp_clause_code kind,
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
return list;
- if (kind == OMP_CLAUSE_REDUCTION && is_omp)
+ if (kind == OMP_CLAUSE_REDUCTION && ort == C_ORT_OMP)
{
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_DEFAULT)
&& cp_lexer_nth_token_is (parser->lexer, 2, CPP_COMMA))
@@ -40083,8 +40086,7 @@ cp_parser_omp_clause_reduction (cp_parser *parser, enum omp_clause_code kind,
if (!cp_parser_require (parser, CPP_COLON, RT_COLON))
goto resync_fail;
- nlist = cp_parser_omp_var_list_no_open (parser, kind, list,
- NULL);
+ nlist = cp_parser_omp_var_list_no_open (parser, kind, list, NULL, ort);
for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
{
OMP_CLAUSE_REDUCTION_CODE (c) = code;
@@ -41403,7 +41405,8 @@ cp_parser_omp_clause_from_to (cp_parser *parser, enum omp_clause_code kind,
cp_lexer_consume_token (parser->lexer);
}
- tree nl = cp_parser_omp_var_list_no_open (parser, kind, list, NULL, true);
+ tree nl = cp_parser_omp_var_list_no_open (parser, kind, list, NULL, C_ORT_OMP,
+ true);
if (present)
for (tree c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
OMP_CLAUSE_MOTION_PRESENT (c) = 1;
@@ -41571,7 +41574,7 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list)
legally. */
begin_scope (sk_omp, NULL);
nlist = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_MAP, list,
- NULL, true);
+ NULL, C_ORT_OMP, true);
finish_scope ();
for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
@@ -42038,7 +42041,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
case PRAGMA_OACC_CLAUSE_REDUCTION:
clauses
= cp_parser_omp_clause_reduction (parser, OMP_CLAUSE_REDUCTION,
- false, clauses);
+ C_ORT_ACC, clauses);
c_name = "reduction";
break;
case PRAGMA_OACC_CLAUSE_SELF:
@@ -42236,7 +42239,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
case PRAGMA_OMP_CLAUSE_IN_REDUCTION:
clauses
= cp_parser_omp_clause_reduction (parser, OMP_CLAUSE_IN_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "in_reduction";
break;
case PRAGMA_OMP_CLAUSE_INDIRECT:
@@ -42291,7 +42294,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
case PRAGMA_OMP_CLAUSE_REDUCTION:
clauses
= cp_parser_omp_clause_reduction (parser, OMP_CLAUSE_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "reduction";
break;
case PRAGMA_OMP_CLAUSE_SCHEDULE:
@@ -42308,7 +42311,7 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
clauses
= cp_parser_omp_clause_reduction (parser,
OMP_CLAUSE_TASK_REDUCTION,
- true, clauses);
+ C_ORT_OMP, clauses);
c_name = "task_reduction";
break;
case PRAGMA_OMP_CLAUSE_UNTIED:
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 1954df10a08..9c7258989f4 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -6579,7 +6579,8 @@ find_omp_placeholder_r (tree *tp, int *, void *data)
Return true if there is some error and the clause should be removed. */
static bool
-finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
+finish_omp_reduction_clause (tree c, enum c_omp_region_type ort,
+ bool *need_default_ctor, bool *need_dtor)
{
tree t = OMP_CLAUSE_DECL (c);
bool predefined = false;
@@ -6825,9 +6826,11 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
*need_dtor = true;
else
{
- error_at (OMP_CLAUSE_LOCATION (c),
- "user defined reduction not found for %qE",
- omp_clause_printable_decl (t));
+ /* There are no user-defined reductions for OpenACC (as of 2.6). */
+ if (ort & C_ORT_OMP)
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "user defined reduction not found for %qE",
+ omp_clause_printable_decl (t));
return true;
}
if (TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF)
@@ -7143,7 +7146,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (openacc)
for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC)
- {
+ {
oacc_async = true;
break;
}
@@ -9376,7 +9379,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (processing_template_decl
&& !VAR_P (t) && TREE_CODE (t) != PARM_DECL)
break;
- if (finish_omp_reduction_clause (c, &need_default_ctor,
+ if (finish_omp_reduction_clause (c, ort, &need_default_ctor,
&need_dtor))
remove = true;
else
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 379b2aee149..23e93c87323 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,12 @@
+2018-12-13 Cesar Philippidis <cesar@codesourcery.com>
+ Nathan Sidwell <nathan@acm.org>
+ Julian Brown <julian@codesourcery.com>
+
+ * openmp.cc (oacc_is_parallel): New.
+ (resolve_oacc_loop_blocks): Emit an error on orphan OpenACC
+ gang reductions.
+ * trans-openmp.ccc (gfc_omp_clause_copy_ctor): Permit reductions.
+
2018-06-29 Cesar Philippidis <cesar@codesourcery.com>
James Norris <jnorris@codesourcery.com>
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 55274e2ff49..ace75710ad2 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -858,7 +858,8 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src)
stmtblock_t block, cond_block;
gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE
- || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LINEAR);
+ || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LINEAR
+ || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_REDUCTION);
/* Privatize pointer, only; cf. gfc_omp_predetermined_sharing. */
if (DECL_P (OMP_CLAUSE_DECL (clause))
More information about the Gcc-cvs
mailing list