diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-07-07 16:33:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-07-07 16:33:13 (GMT) |
commit | 7d4bb6efd27d5ec2321cef54f3e17f4852f585ec (patch) | |
tree | b8b4f77759963aeae09290fdec39875654fc3b49 | |
parent | 8732e5f0d839babd0ccf33917e8de75a3cc1602a (diff) | |
download | hdf5-7d4bb6efd27d5ec2321cef54f3e17f4852f585ec.zip hdf5-7d4bb6efd27d5ec2321cef54f3e17f4852f585ec.tar.gz hdf5-7d4bb6efd27d5ec2321cef54f3e17f4852f585ec.tar.bz2 |
[svn-r7174] Purpose:
Bug fix
Description:
Fix "unaligned access" warning on IA64 (and alpha, probably) machines.
Solution:
Make certain that temporary destination buffer is aligned on correct
boundary for type conversion.
Platforms tested:
IA64 Linux cluster (titan)
too small for h5committest
-rw-r--r-- | src/H5Tconv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 44dde72..ab4ef71 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2126,7 +2126,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, size_t conv_buf_size=0; /*size of conversion buffer in bytes */ void *tmp_buf=NULL; /*temporary background buffer */ size_t tmp_buf_size=0; /*size of temporary bkg buffer */ - uint8_t dbuf[64],*dbuf_ptr=dbuf;/*temp destination buffer */ + uint8_t dbuf[64],*dbuf_ptr; /*temp destination buffer */ int direction; /*direction of traversal */ int nested=0; /*flag of nested VL case */ hsize_t elmtno; /*element number counter */ @@ -2205,6 +2205,12 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, dst_delta = direction * (buf_stride ? buf_stride : dst->size); bkg_delta = direction * (bkg_stride ? bkg_stride : dst->size); + /* Set the dbuf_ptr correctly, based on the alignment of the dbuf */ + /* (Have to use the maximum alignment of hvl_t and 'char *' types */ + /* since this routine is used for both variable-length sequences */ + /* and variable-length strings) */ + dbuf_ptr=dbuf+(((size_t)dbuf)%MAX(H5T_HVL_COMP_ALIGN_g,H5T_POINTER_COMP_ALIGN_g)); + /* * If the source and destination buffers overlap then use a * temporary buffer for the destination. @@ -2334,7 +2340,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts, * then we should copy the value to the true destination * buffer. */ - if (d==dbuf) HDmemcpy (dp, d, dst->size); + if (d==dbuf_ptr) HDmemcpy (dp, d, dst->size); sp += src_delta; dp += dst_delta; if(bg_ptr!=NULL) |