Hi,

this patch adds a few asserts to nvptx_goacc_validate_dims.

Committed to trunk.

Thanks,
- Tom

[nvptx] Add asserts in nvptx_goacc_validate_dims

2019-01-07  Tom de Vries  <tdevr...@suse.de>

        * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add asserts.

---
 gcc/config/nvptx/nvptx.c | 4 ++++
 1 file changed, 4 insertions(+)

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;

Reply via email to