summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-07-07 16:32:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-07-07 16:32:13 (GMT)
commit42d5893f16addc58853bd6a5668ce4335121c072 (patch)
treebe685acdd86beee94e5e362598f359104b6fa7c4
parent6028d7f9c9a7a8ff109368b89898e010cc4abcbb (diff)
downloadhdf5-42d5893f16addc58853bd6a5668ce4335121c072.zip
hdf5-42d5893f16addc58853bd6a5668ce4335121c072.tar.gz
hdf5-42d5893f16addc58853bd6a5668ce4335121c072.tar.bz2
[svn-r7173] 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.c10
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)