summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2008-09-18 20:53:30 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2008-09-18 20:53:30 (GMT)
commitc254b0bc27536c91c7bb0ffa4269aba76f00fbff (patch)
tree3eeb46e4d97355e23af266b38d2b4f94091f3803 /configure
parent67cf35a4631348cfcc1ef150b3b7365ca9a56e33 (diff)
downloadhdf5-c254b0bc27536c91c7bb0ffa4269aba76f00fbff.zip
hdf5-c254b0bc27536c91c7bb0ffa4269aba76f00fbff.tar.gz
hdf5-c254b0bc27536c91c7bb0ffa4269aba76f00fbff.tar.bz2
[svn-r15656] Purpose: fix bug 1286
Description: Added configure test to see if pointer alignment restrictions are enforced (as in dereferencing an unaligned pointer causes an error). Added code in H5Tvlen.c to avoid dereferencing unaligned pointers, conditionally compiled based on the configure test. Added test case in dtypes.c which would previously cause such machines to fail. Tested: kagiso, smirom, linew (h5committest); linew64
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure110
1 files changed, 110 insertions, 0 deletions
diff --git a/configure b/configure
index c483a1e..f14f93b 100755
--- a/configure
+++ b/configure
@@ -50770,6 +50770,116 @@ echo "${ECHO_T}no" >&6; }
esac
+{ echo "$as_me:$LINENO: checking if alignment restrictions are strictly enforced" >&5
+echo $ECHO_N "checking if alignment restrictions are strictly enforced... $ECHO_C" >&6; }
+if test "$cross_compiling" = yes; then
+
+ { echo "$as_me:$LINENO: result: unknown, assuming yes" >&5
+echo "${ECHO_T}unknown, assuming yes" >&6; }
+
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <stdlib.h>
+ #include <string.h>
+
+ typedef struct {
+ size_t len;
+ void *p;
+ } hvl_t;
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+
+ char *chp = "beefs";
+ char **chpp = malloc (2 * sizeof (char *));
+ char **chpp2;
+ hvl_t vl = { 12345, (void *) chp };
+ hvl_t *vlp;
+ hvl_t *vlp2;
+
+ memcpy ((void *) ((char *) chpp + 1), &chp, sizeof (char *));
+ chpp2 = (char **) ((char *) chpp + 1);
+ if (strcmp (*chpp2, chp)) {
+ free (chpp);
+ return 1;
+ }
+ free (chpp);
+
+ vlp = malloc (2 * sizeof (hvl_t));
+ memcpy ((void *) ((char *) vlp + 1), &vl, sizeof (hvl_t));
+ vlp2 = (hvl_t *) ((char *) vlp + 1);
+ if (vlp2->len != vl.len || vlp2->p != vl.p) {
+ free (vlp);
+ return 1;
+ }
+ free (vlp);
+
+ ;
+ return 0;
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_ALIGNMENT_RESTRICTIONS 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
if test "X$HDF_CXX" = "Xyes"; then
BUILD_CXX_CONDITIONAL_TRUE=