summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-17 12:57:36 (GMT)
committerGitHub <noreply@github.com>2021-06-17 12:57:36 (GMT)
commit73ad91422968ba56ab55edb6840aa48e36eee7b2 (patch)
tree9535fe88e00bf8fd9727026b21f10b72853551d1 /c++/test
parent16e9b6941016abd4fb9a8870f9ed3c4c07fbbf1b (diff)
downloadhdf5-73ad91422968ba56ab55edb6840aa48e36eee7b2.zip
hdf5-73ad91422968ba56ab55edb6840aa48e36eee7b2.tar.gz
hdf5-73ad91422968ba56ab55edb6840aa48e36eee7b2.tar.bz2
Fixes an array issue flagged by PGI in a C++ test (#763)
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/ttypes.cpp7
1 files 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<unsigned>(i * ds_size[1] + j);
+ }
+ }
attr1.write(PredType::NATIVE_UINT, attr_data);
attr1.close();