From 3604c17051dd13c8bfb09f94dd7ef8aab5e14a5a Mon Sep 17 00:00:00 2001 From: Xiaowen Wu Date: Wed, 13 Apr 2005 21:05:42 -0500 Subject: [svn-r10603] Purpose: Bug fix. Description: The nbit filter test case (compound datatype with no-op field) can not pass the daily test on heping and eirene when the enable-production option is set with configure and PGI compiler is used. It will generate segmentation fault. Solution: It was found that the seg fault disappears when adding a new index variable in the test case and using it instead of using an existing index variable twice during initialization. This does not make much sense since previous codes is logically equivalent to the changed codes. So, some other factors beyond the test case codes may have caused the problem. Platforms tested: heping Misc. update: --- test/dsets.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/dsets.c b/test/dsets.c index 1d0cdba..ad92dcc 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -3589,7 +3589,7 @@ test_nbit_compound_3(hid_t file) const hsize_t chunk_size[1] = {5}; atomic orig_data[5]; atomic new_data[5]; - hsize_t i, k; + hsize_t i, k, j; #else /* H5_HAVE_FILTER_NBIT */ const char *not_supported= " Nbit is not enabled."; @@ -3610,7 +3610,7 @@ test_nbit_compound_3(hid_t file) if((v_tid = H5Tvlen_create(H5T_NATIVE_UINT))<0) goto error; - if((o_tid = H5Tcreate(H5T_OPAQUE, sizeof(orig_data[0].o)))<0) goto error; + if((o_tid = H5Tcreate(H5T_OPAQUE, 5))<0) goto error; if(H5Tset_tag(o_tid, "testing opaque field")<0) goto error; /* Create a dataset compound datatype and insert some atomic types */ @@ -3646,12 +3646,12 @@ test_nbit_compound_3(hid_t file) orig_data[i].v.p = HDmalloc((i+1)*sizeof(unsigned int)); orig_data[i].v.len = i+1; - for(k = 0; k < (i+1); k++) ((unsigned int *)orig_data[i].v.p)[k]=i*100+k; + for(k = 0; k < (i+1); k++) ((unsigned int *)orig_data[i].v.p)[k] = i*100 + k; /* Create reference to the dataset "nbit_obj_ref" */ if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, -1)<0) goto error; - for(k = 0; k < 5; k++) orig_data[i].o[k] = i + k; + for(j = 0; j < 5; j++) orig_data[i].o[j] = i + j; } PASSED(); @@ -3712,8 +3712,8 @@ test_nbit_compound_3(hid_t file) goto error; } - for(k=0; k<5; k++) - if(orig_data[i].o[k] != new_data[i].o[k]) + for(j=0; j<5; j++) + if(orig_data[i].o[j] != new_data[i].o[j]) { H5_FAILED(); printf(" Read different values than written.\n"); -- cgit v0.12