This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [3/6] OpenMP 4.0 C++ FE support
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Richard Henderson <rth at redhat dot com>, Torvald Riegel <triegel at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Oct 2013 20:17:55 -0400
- Subject: Re: [3/6] OpenMP 4.0 C++ FE support
- Authentication-results: sourceware.org; auth=none
- References: <20131008195320 dot GB30970 at tucnak dot zalov dot cz>
On 10/08/2013 03:53 PM, Jakub Jelinek wrote:
case OMP_CLAUSE_REDUCTION:
- gcc_assert (!is_invisiref_parm (OMP_CLAUSE_DECL (stmt)));
+ if (is_invisiref_parm (OMP_CLAUSE_DECL (stmt)))
+ {
+ *walk_subtrees = 0;
+ if (OMP_CLAUSE_REDUCTION_INIT (stmt))
+ cp_walk_tree (&OMP_CLAUSE_REDUCTION_INIT (stmt),
+ cp_genericize_r, data, NULL);
+ if (OMP_CLAUSE_REDUCTION_MERGE (stmt))
+ cp_walk_tree (&OMP_CLAUSE_REDUCTION_MERGE (stmt),
+ cp_genericize_r, data, NULL);
+ }
Please add a comment explaining why an invisiref decl is handled specially.
@@ -1345,6 +1384,30 @@ cplus_decl_attributes (tree *decl, tree
|| *decl == error_mark_node)
return;
+ /* Add implicit "omp declare target" attribute if requested. */
+ if (current_omp_declare_target_attribute
This can be called during template instantiation, so we don't want to
use the value of this from the current parse context. Either move the
variable into cp_parser and tack on the attribute in the parser as well,
or move the variable into saved_scope so that it's handled by
push_to_top_level.
+ /* #pragma omp declare simd attribute needs to be always finalized. */
+ if (flag_openmp
+ && is_attribute_p ("omp declare simd", name))
+ return true;
The comment doesn't seem to match the code here; the code is always
deferring the attribute until instantiation time. Maybe just
s/finalized/deferred/?
+ if (TREE_VALUE (attr) == NULL_TREE
+ || TREE_CODE (TREE_VALUE (attr)) != TREE_LIST)
+ continue;
You're breaking the convention that the TREE_VALUE of an attribute is
always a list? That seems like a bad idea.
+cp_omp_mappable_type (tree type)
Do you want to check TYPE_OBJ_P here? Can a reference be mappable?
+ && RECORD_OR_UNION_CODE_P (TREE_CODE (CP_DECL_CONTEXT (*decl))))
DECL_CLASS_SCOPE_P (*decl)
+ && (TREE_CODE (CP_DECL_CONTEXT (*decl)) == FUNCTION_DECL
DECL_FUNCTION_SCOPE_P (*decl)
+ "for pointer type length expression is not optional");
I'd say "must be specified".
+ omp_out = build_fold_addr_expr (omp_out);
+ omp_out = build_static_cast (ptype, omp_out,
+ tf_warning_or_error);
+ omp_in = build_fold_addr_expr (omp_in);
+ omp_in = build_static_cast (ptype, omp_in,
+ tf_warning_or_error);
+ if (omp_out == error_mark_node || omp_in == error_mark_node)
+ return true;
+ omp_out = build1 (INDIRECT_REF, atype, omp_out);
+ omp_in = build1 (INDIRECT_REF, atype, omp_in);
Casting to a reference type would be shorter.
+ error ("linear clause applied to non-integral non-pointer");
This error should include the offending type.
Jason