Commit 8ab7005b by Jakub Jelinek Committed by Jakub Jelinek

re PR c/81006 (ICE with zero-size array and #pragma omp task depend)

	PR c/81006
	* c-typeck.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
	to sizetype before size_binop.

	* semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
	to sizetype before size_binop.

	* c-c++-common/gomp/pr81006.c: New test.

From-SVN: r249035
parent 20e96b48
2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR c/81006
* c-typeck.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
to sizetype before size_binop.
2017-06-07 Jakub Jelinek <jakub@redhat.com> 2017-06-07 Jakub Jelinek <jakub@redhat.com>
* gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead * gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead
......
...@@ -12364,9 +12364,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, ...@@ -12364,9 +12364,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
&& TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
== INTEGER_CST) == INTEGER_CST)
{ {
tree size = size_binop (PLUS_EXPR, tree size
TYPE_MAX_VALUE (TYPE_DOMAIN (type)), = fold_convert (sizetype, TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
size_one_node); size = size_binop (PLUS_EXPR, size, size_one_node);
if (TREE_CODE (low_bound) == INTEGER_CST) if (TREE_CODE (low_bound) == INTEGER_CST)
{ {
if (tree_int_cst_lt (size, low_bound)) if (tree_int_cst_lt (size, low_bound))
......
2017-06-08 Jakub Jelinek <jakub@redhat.com> 2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR c/81006
* semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
to sizetype before size_binop.
PR c++/81011 PR c++/81011
* cp-gimplify.c (cxx_omp_finish_clause): When changing clause * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
......
...@@ -4731,9 +4731,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, ...@@ -4731,9 +4731,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
&& TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
== INTEGER_CST) == INTEGER_CST)
{ {
tree size = size_binop (PLUS_EXPR, tree size
TYPE_MAX_VALUE (TYPE_DOMAIN (type)), = fold_convert (sizetype, TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
size_one_node); size = size_binop (PLUS_EXPR, size, size_one_node);
if (TREE_CODE (low_bound) == INTEGER_CST) if (TREE_CODE (low_bound) == INTEGER_CST)
{ {
if (tree_int_cst_lt (size, low_bound)) if (tree_int_cst_lt (size, low_bound))
......
2017-06-08 Jakub Jelinek <jakub@redhat.com> 2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR c/81006
* c-c++-common/gomp/pr81006.c: New test.
PR c++/81011 PR c++/81011
* g++.dg/gomp/pr81011.C: New test. * g++.dg/gomp/pr81011.C: New test.
......
/* PR c/81006 */
/* { dg-do compile } */
int a[] = {};
void foo()
{
#pragma omp task depend(out: a[:]) /* { dg-error "zero length array section in .depend. clause" } */
{}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment