aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-06-08 21:10:49 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-06-08 21:10:49 +0200
commit8ab7005b1420687c0e31a28a4e6e9fd05bb7f22e (patch)
treeaec1d25f339f1ecbb52d004325a72dfac4ffc379 /gcc/c
parent20e96b489ea501861c0bb6e509888275d682ed2f (diff)
downloadgcc-8ab7005b1420687c0e31a28a4e6e9fd05bb7f22e.zip
gcc-8ab7005b1420687c0e31a28a4e6e9fd05bb7f22e.tar.gz
gcc-8ab7005b1420687c0e31a28a4e6e9fd05bb7f22e.tar.bz2
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
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c6
2 files changed, 9 insertions, 3 deletions
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 <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>
* 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<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))