gcc_assert (!error_operand_p (idxtype));
- sectype = build_array_type (eltype, idxtype);
+ sectype = c_build_array_type (eltype, idxtype);
}
- return build3_loc (loc, OMP_ARRAY_SECTION, sectype, array, index, length);
+ return build4_loc (loc, OMP_ARRAY_SECTION, sectype, array, index, length,
+ stride);
+}
+
+/* Build an array type whose dimensions are given by OMP_SHAPE_DIMS and whose
+ elements are of the type pointed to by the "base" node of EXPR with outer
+ OMP_ARRAY_SECTIONs and ARRAY_REFs stripped off, e.g. the type of "*myptr"
+ in "myptr[0:2:3][4][5:6]". */
+
+tree
+create_omp_arrayshape_type (tree expr, vec<tree> *omp_shape_dims)
+{
+ tree strip_sections = expr;
+
+ while (TREE_CODE (strip_sections) == OMP_ARRAY_SECTION
+ || TREE_CODE (strip_sections) == ARRAY_REF)
+ strip_sections = TREE_OPERAND (strip_sections, 0);
+
+ tree type = TREE_TYPE (strip_sections);
+
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
+
+ if (TREE_CODE (type) != POINTER_TYPE)
+ {
+ error ("OpenMP array shaping operator with non-pointer argument");
+ return error_mark_node;
+ }
+
+ type = TREE_TYPE (type);
+
+ int i;
+ tree dim;
+ FOR_EACH_VEC_ELT_REVERSE (*omp_shape_dims, i, dim)
+ {
+ tree maxidx = fold_convert (sizetype, dim);
+ maxidx = size_binop (MINUS_EXPR, maxidx, size_one_node);
+ tree index = build_index_type (maxidx);
+ type = build_array_type (type, index);
+ }
+
+ return type;
}
\f
body, except inside an unevaluated context (i.e. decltype). */
if (TREE_CODE (decl) == PARM_DECL
&& DECL_CONTEXT (decl) == NULL_TREE
+ && !CONSTRAINT_VAR_P (decl)
&& !cp_unevaluated_operand
- && !processing_contract_condition)
+ && !processing_contract_condition
+ && !processing_omp_trait_property_expr)
{
*error_msg = G_("use of parameter outside function body");
return error_mark_node;