From ed165e2935de2e8fb6b8c5ca5dc8788033cc6368 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 17 Jun 2021 05:12:48 -0700 Subject: [PATCH] Fixes an array issue flagged by PGI in a C++ test --- 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 5fc82a50994..a244965310e 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();