From e1c1f5cc1543fccb47e46cc85531a6a4646e0fad Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 10 Oct 2004 14:22:03 -0500 Subject: [svn-r9395] Purpose: Bug fix Description: Correct a couple of array bounds issues exposed by the PGI compiler Platforms tested: Linux 2.4 (verbena) w/PGI compilers Too minor too requie h5committest --- test/dtypes.c | 6 ++++-- test/tarray.c | 6 +++--- tools/lib/h5tools.c | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/test/dtypes.c b/test/dtypes.c index 2206134..3dfb53b 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -2695,7 +2695,7 @@ test_named (hid_t fapl) hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, attr1=-1; herr_t status; static hsize_t ds_size[2] = {10, 20}; - hsize_t i; + hsize_t i,j; unsigned attr_data[10][20]; char filename[1024]; @@ -2751,7 +2751,9 @@ test_named (hid_t fapl) /* It should be possible to define an attribute for the named type */ if ((attr1=H5Acreate (type, "attr1", H5T_NATIVE_UCHAR, space, H5P_DEFAULT))<0) goto error; - for (i=0; i 0) - for (i = 0, p_nelmts = 1; i < ctx.ndims; i++) + if (ctx.ndims > 0) { + for (i = 0; i < ctx.ndims; i++) p_nelmts *= total_size[i]; + ctx.size_last_dim = (total_size[ctx.ndims - 1]); + } /* end if */ + else + ctx.size_last_dim = 0; if (p_nelmts == 0) { /* nothing to print */ @@ -1062,8 +1065,12 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, if (nelmts == 0) return SUCCEED; /*nothing to print*/ - assert(ctx.p_max_idx[ctx.ndims - 1]==(hsize_t)((int)ctx.p_max_idx[ctx.ndims - 1])); - ctx.size_last_dim = (int)(ctx.p_max_idx[ctx.ndims - 1]); + if(ctx.ndims>0) { + assert(ctx.p_max_idx[ctx.ndims - 1]==(hsize_t)((int)ctx.p_max_idx[ctx.ndims - 1])); + ctx.size_last_dim = (int)(ctx.p_max_idx[ctx.ndims - 1]); + } /* end if */ + else + ctx.size_last_dim = 0; /* Print it */ h5tools_dump_simple_data(stream, info, obj_id, &ctx, -- cgit v0.12