openmp: Change the way of building of reduction array type

The PR98597 patch regresses on _Atomic-3.c, as in the C FE building an
array type with qualified elements results in a type incompatible with
when an array type with unqualified elements is qualified afterwards.
This patch adds a workaround for that.

2021-01-15  Jakub Jelinek  <jakub@redhat.com>

	* c-typeck.c (c_finish_omp_clauses): For reduction build array with
	unqualified element type and then call c_build_qualified_type on the
	ARRAY_TYPE.
This commit is contained in:
Jakub Jelinek 2021-01-15 19:17:53 +01:00
parent d3959070aa
commit 50dbced2f3

View File

@ -13979,7 +13979,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
size = size_binop (MINUS_EXPR, size, size_one_node); size = size_binop (MINUS_EXPR, size, size_one_node);
size = save_expr (size); size = save_expr (size);
tree index_type = build_index_type (size); tree index_type = build_index_type (size);
tree atype = build_array_type (type, index_type); tree atype = build_array_type (TYPE_MAIN_VARIANT (type),
index_type);
atype = c_build_qualified_type (atype, TYPE_QUALS (type));
tree ptype = build_pointer_type (type); tree ptype = build_pointer_type (type);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
t = build_fold_addr_expr (t); t = build_fold_addr_expr (t);