From 8ab7005b1420687c0e31a28a4e6e9fd05bb7f22e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 8 Jun 2017 21:10:49 +0200 Subject: 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 --- gcc/c/ChangeLog | 6 ++++++ gcc/c/c-typeck.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 0f23eb3..e94bcea 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-06-08 Jakub Jelinek + + 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 * gimple-parser.c (c_parser_parse_gimple_body): Use TDI_gimple instead diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 92aab54..00e16e8 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -12364,9 +12364,9 @@ handle_omp_array_sections_1 (tree c, tree t, vec &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)) -- cgit v1.1