From: Tom de Vries Date: Mon, 7 Jan 2019 08:09:58 +0000 (+0000) Subject: [nvptx] Add asserts in nvptx_goacc_validate_dims X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21fbea5c338f96a5f291ca8e4bc68a4dfbf6af6d;p=gcc.git [nvptx] Add asserts in nvptx_goacc_validate_dims Add a few asserts to nvptx_goacc_validate_dims. 2019-01-07 Tom de Vries * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add asserts. From-SVN: r267625 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2d4e60b926..91f71bc94db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-01-07 Tom de Vries + + * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add asserts. + 2019-01-07 Tom de Vries * omp-offload.c (oacc_get_min_dim): New function. diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 5d0bab65d07..c0a58f3aee5 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -5421,6 +5421,10 @@ nvptx_goacc_validate_dims (tree decl, int dims[], int fn_level) nvptx_goacc_validate_dims_1 (decl, dims, fn_level); + gcc_assert (dims[GOMP_DIM_VECTOR] != 0); + if (dims[GOMP_DIM_WORKER] > 0 && dims[GOMP_DIM_VECTOR] > 0) + gcc_assert (dims[GOMP_DIM_WORKER] * dims[GOMP_DIM_VECTOR] <= PTX_CTA_SIZE); + for (i = 0; i < GOMP_DIM_MAX; ++i) if (old_dims[i] != dims[i]) return true;