From 73ad91422968ba56ab55edb6840aa48e36eee7b2 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 17 Jun 2021 05:57:36 -0700 Subject: Fixes an array issue flagged by PGI in a C++ test (#763) --- c++/test/ttypes.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 5fc82a5..a244965 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -726,8 +726,11 @@ test_named() // It should be possible to define an attribute for the named type Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); - for (i = 0; i < ds_size[0] * ds_size[1]; i++) - attr_data[0][i] = (int)i; /*tricky*/ + for (hsize_t i = 0; i < ds_size[0]; i++) { + for (hsize_t j = 0; j < ds_size[1]; j++) { + attr_data[i][j] = static_cast(i * ds_size[1] + j); + } + } attr1.write(PredType::NATIVE_UINT, attr_data); attr1.close(); -- cgit v0.12