summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-06 13:44:33 (GMT)
committerGitHub <noreply@github.com>2023-06-06 13:44:33 (GMT)
commit4c57a5b06417e823eef153ae306a6ce06bd907ee (patch)
treedc0784d24d72b44e4b25797bec8f000496c9886f /src
parentb5b1f4c7dfcc4a40af7c6c8ab1c89e49054f33c6 (diff)
downloadhdf5-4c57a5b06417e823eef153ae306a6ce06bd907ee.zip
hdf5-4c57a5b06417e823eef153ae306a6ce06bd907ee.tar.gz
hdf5-4c57a5b06417e823eef153ae306a6ce06bd907ee.tar.bz2
Bring key changesets from develop (#3052)
* Bump GitHub action macOS version to 13 (#2999, #3009) * Bump GitHub action gcc/g++/gfortran version to 12 (#3015) * Bump Autoconf version to 2.71 (#2944) * Fix missing h5_reset() calls in accum test (#3001) * Only run ttsafe in GitHub thread-safe actions (#2777) * Fix Java debug asserts on Windows (#3012) * Fix long double dt_arith bug on macOS (#3038)
Diffstat (limited to 'src')
-rw-r--r--src/H5FDtest.c6
-rw-r--r--src/H5Tconv.c24
2 files changed, 22 insertions, 8 deletions
diff --git a/src/H5FDtest.c b/src/H5FDtest.c
index dc9ad93..87d24b6 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -71,8 +71,6 @@
* VFD feature flags (which do not exist until the driver
* is instantiated).
*
- * See test/Makefile.am for a list of the VFD strings.
- *
* This function is only intended for use in the test code.
*
* Return: TRUE (1) if the VFD supports SWMR I/O or vfd_name is
@@ -82,10 +80,6 @@
*
* This function cannot fail at this time so there is no
* error return value.
- *
- * Programmer: Dana Robinson
- * Fall 2014
- *
*-------------------------------------------------------------------------
*/
hbool_t
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 5deae85..f6ab0d7 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -887,7 +887,17 @@ done:
/* Macro defining action on source data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_SALIGN(ST) \
{ \
- H5MM_memcpy(&src_aligned, src, sizeof(ST)); \
+ /* The uint8_t * cast is required to avoid tripping over undefined behavior. \
+ * \
+ * The typed pointer arrives via a void pointer, which may have any alignment. \
+ * We then cast it to a pointer to a type that is assumed to be aligned, which \
+ * is undefined behavior (section 6.3.2.3 paragraph 7 of the C99 standard). \
+ * In the past this hasn't caused many problems, but in some cases (e.g. \
+ * converting long doubles on macOS), an optimizing compiler might do the \
+ * wrong thing (in the macOS case, the conversion uses SSE, which has stricter \
+ * requirements about alignment). \
+ */ \
+ H5MM_memcpy(&src_aligned, (const uint8_t *)src, sizeof(ST)); \
}
/* Macro defining action on source data which doesn't need to be aligned (before main action) */
@@ -919,7 +929,17 @@ done:
/* Macro defining action on destination data which needs to be aligned (after main action) */
#define H5T_CONV_LOOP_POST_DALIGN(DT) \
{ \
- H5MM_memcpy(dst, &dst_aligned, sizeof(DT)); \
+ /* The uint8_t * cast is required to avoid tripping over undefined behavior. \
+ * \
+ * The typed pointer arrives via a void pointer, which may have any alignment. \
+ * We then cast it to a pointer to a type that is assumed to be aligned, which \
+ * is undefined behavior (section 6.3.2.3 paragraph 7 of the C99 standard). \
+ * In the past this hasn't caused many problems, but in some cases (e.g. \
+ * converting long doubles on macOS), an optimizing compiler might do the \
+ * wrong thing (in the macOS case, the conversion uses SSE, which has stricter \
+ * requirements about alignment). \
+ */ \
+ H5MM_memcpy((uint8_t *)dst, &dst_aligned, sizeof(DT)); \
}
/* Macro defining action on destination data which doesn't need to be aligned (after main action) */