summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-10-26 14:25:16 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-10-26 14:25:16 (GMT)
commitc61a0a3d6200c6513cc49c4fe5cb05e0313e571a (patch)
tree97e7e3a640ac87219dd90a787021a768938aed21 /test
parent9b7016e1d76779c9b5ba459a8eb41006d373766a (diff)
downloadhdf5-c61a0a3d6200c6513cc49c4fe5cb05e0313e571a.zip
hdf5-c61a0a3d6200c6513cc49c4fe5cb05e0313e571a.tar.gz
hdf5-c61a0a3d6200c6513cc49c4fe5cb05e0313e571a.tar.bz2
[svn-r21674] Issue 7618 - the library had seg fault when it tried to shrink the size of compound data type through H5Tset_size immedia
tely after the type was created. I fixed it in this commit. Tested on jam, linew, and koala.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 7138823..e0d1f8f 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -523,6 +523,12 @@ test_compound_1(void)
if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0)
goto error;
+ /* Try to shrink and expand the size */
+ if(H5Tset_size(complex_id, sizeof(double)) < 0)
+ goto error;
+ if(H5Tset_size(complex_id, sizeof(complex_t)) < 0)
+ goto error;
+
/* Attempt to add the new compound datatype as a field within itself */
H5E_BEGIN_TRY {
ret=H5Tinsert(complex_id, "compound", (size_t)0, complex_id);
@@ -538,6 +544,14 @@ test_compound_1(void)
goto error;
/* Test some functions that aren't supposed to work for compound type */
+ /* Tries to shrink the size and trail the last member */
+ H5E_BEGIN_TRY {
+ ret=H5Tset_size(complex_id, sizeof(double));
+ } H5E_END_TRY;
+ if (ret>=0) {
+ FAIL_PUTS_ERROR("Operation not allowed for this type.");
+ } /* end if */
+
H5E_BEGIN_TRY {
size=H5Tget_precision(complex_id);
} H5E_END_TRY;