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: r249036
This commit is contained in:
Jakub Jelinek 2017-06-08 21:12:38 +02:00 committed by Jakub Jelinek
parent d5e8341185
commit 7d75cd45a7
6 changed files with 29 additions and 6 deletions

View File

@ -1,3 +1,9 @@
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-05-26 Marek Polacek <polacek@redhat.com>
Backported from mainline

View File

@ -12355,9 +12355,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
&& TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
== INTEGER_CST)
{
tree size = size_binop (PLUS_EXPR,
TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
size_one_node);
tree size
= fold_convert (sizetype, TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
size = size_binop (PLUS_EXPR, size, size_one_node);
if (TREE_CODE (low_bound) == INTEGER_CST)
{
if (tree_int_cst_lt (size, low_bound))

View File

@ -1,5 +1,9 @@
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
* cp-gimplify.c (cxx_omp_finish_clause): When changing clause
to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE

View File

@ -4707,9 +4707,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
&& TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
== INTEGER_CST)
{
tree size = size_binop (PLUS_EXPR,
TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
size_one_node);
tree size
= fold_convert (sizetype, TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
size = size_binop (PLUS_EXPR, size, size_one_node);
if (TREE_CODE (low_bound) == INTEGER_CST)
{
if (tree_int_cst_lt (size, low_bound))

View File

@ -1,5 +1,8 @@
2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR c/81006
* c-c++-common/gomp/pr81006.c: New test.
PR c++/81011
* g++.dg/gomp/pr81011.C: New test.

View File

@ -0,0 +1,10 @@
/* 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" } */
{}
}